- Neural Networks with Keras Cookbook
- V Kishore Ayyadevara
- 320字
- 2021-07-02 12:46:29
Understanding the scenario of overfitting
In some of the previous recipes, we have noticed that the training accuracy is ~100%, while test accuracy is ~98%, which is a case of overfitting on top of a training dataset. Let's gain an intuition of the delta between the training and the test accuracies.
To understand the phenomenon resulting in overfitting, let's contrast two scenarios where we compare the training and test accuracies along with a histogram of the weights:
- Model is run for five epochs
- Model is run for 100 epochs
The comparison-of-accuracy metric between training and test datasets between the two scenarios is as follows:

Once we plot the histogram of weights that are connecting the hidden layer to the output layer, we will notice that the 100-epochs scenario has a higher spread of weights when compared to the five-epochs scenario:


From the preceding pictures, you should note that the 100 epochs scenario had a higher dispersion of weight values when compared to the five-epochs scenario. This is because of the higher amount of opportunity that the model had to overfit on top of the training dataset when the model is run for 100-epochs, when compared to when the model is run for five epochs, as the number of weight updates in the 100-epochs scenario is higher than the number of weight updates in the five-epochs scenario.
A high value of weight (along with a difference in the training and test dataset) is a good indication of a potential over-fitting of the model and/or a potential opportunity to scale input/weights to increase the accuracy of the model.
Additionally, also note that a neural network can have hundreds of thousands of weights (and millions in certain architectures) that need to be adjusted, and thus, there is always a chance that one or the other weight can get updated to a very high number to fine-tune for one outlier row of the dataset.
- Extending Jenkins
- 黑客攻防從入門到精通(實(shí)戰(zhàn)秘笈版)
- ServiceNow Application Development
- PHP基礎(chǔ)案例教程
- INSTANT MinGW Starter
- Python數(shù)據(jù)結(jié)構(gòu)與算法(視頻教學(xué)版)
- 案例式C語言程序設(shè)計(jì)實(shí)驗(yàn)指導(dǎo)
- Domain-Driven Design in PHP
- HoloLens與混合現(xiàn)實(shí)開發(fā)
- Visual Basic程序設(shè)計(jì)(第三版)
- Managing Microsoft Hybrid Clouds
- iOS開發(fā)項(xiàng)目化入門教程
- 分布式架構(gòu)原理與實(shí)踐
- Solr權(quán)威指南(下卷)
- Qt 5.12實(shí)戰(zhàn)