The Elements of Statistical Learning. Data Mining_ Inference_ and Prediction (811377), страница 86
Текст из файла (страница 86)
These avoid explicit computationof the second derivative matrix while still providing faster convergence.11.5 Some Issues in Training Neural NetworksThere is quite an art in training neural networks. The model is generallyoverparametrized, and the optimization problem is nonconvex and unstableunless certain guidelines are followed.
In this section we summarize someof the important issues.11.5.1 Starting ValuesNote that if the weights are near zero, then the operative part of the sigmoid(Figure 11.3) is roughly linear, and hence the neural network collapses intoan approximately linear model (Exercise 11.2). Usually starting values forweights are chosen to be random values near zero. Hence the model startsout nearly linear, and becomes nonlinear as the weights increase. Individual398Neural Networksunits localize to directions and introduce nonlinearities where needed. Useof exact zero weights leads to zero derivatives and perfect symmetry, andthe algorithm never moves. Starting instead with large weights often leadsto poor solutions.11.5.2 OverfittingOften neural networks have too many weights and will overfit the data atthe global minimum of R. In early developments of neural networks, eitherby design or by accident, an early stopping rule was used to avoid overfitting.
Here we train the model only for a while, and stop well before weapproach the global minimum. Since the weights start at a highly regularized (linear) solution, this has the effect of shrinking the final model towarda linear model. A validation dataset is useful for determining when to stop,since we expect the validation error to start increasing.A more explicit method for regularization is weight decay, which is analogous to ridge regression used for linear models (Section 3.4.1).
We add apenalty to the error function R(θ) + λJ(θ), whereXX22J(θ) =βkm+αmℓ(11.16)kmmℓand λ ≥ 0 is a tuning parameter. Larger values of λ will tend to shrinkthe weights toward zero: typically cross-validation is used to estimate λ.The effect of the penalty is to simply add terms 2βkm and 2αmℓ to therespective gradient expressions (11.13). Other forms for the penalty havebeen proposed, for example,J(θ) =Xkm2X α2βkmmℓ+22 ,1 + βkm1 + αmℓ(11.17)mℓknown as the weight elimination penalty. This has the effect of shrinkingsmaller weights more than (11.16) does.Figure 11.4 shows the result of training a neural network with ten hiddenunits, without weight decay (upper panel) and with weight decay (lowerpanel), to the mixture example of Chapter 2. Weight decay has clearlyimproved the prediction.
Figure 11.5 shows heat maps of the estimatedweights from the training (grayscale versions of these are called Hintondiagrams.) We see that weight decay has dampened the weights in bothlayers: the resulting weights are spread fairly evenly over the ten hiddenunits.11.5.3 Scaling of the InputsSince the scaling of the inputs determines the effective scaling of the weightsin the bottom layer, it can have a large effect on the quality of the final11.5 Some Issues in Training Neural Networks399Neural Network - 10 Units, No Weight Decay.. ..
.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ..... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. ..
.. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
.. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ..... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. ..
.. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ..... .. .. ..
.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
.. .. .. ..... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ..... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. ..
.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
.. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ..... .. .. .. .. .. .. .. .. .. .. .. .. ..
.. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ..... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. ..
.. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... ..Training. . . . . . . . .. .. .. .. .. .. 0.100........ .. ... ... ... ... ... ... ... ... Error:.. .. .. .. .. ..
... ... ... ... ... ...... ...Test.. .. .. .. ... ... ... ... ... ... ... ... ... ... 0.259.. .. .. .. .. .... .. ... ... ... ... Error:.. .. .. .. .. .. .. .. .. .. ... ... ... ... ... ..... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..Bayes Error: 0.210o..... ..... o.....
..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ....... .. .. .. .. ..o.........................................o.. .. ..
.. ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...... ...o.. .. ..o..o.. .. .. .. .. .. .. .. .. .. .. .. .. o.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..o o.. .. o...... ..o.. .. ..
.. ...o... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...o o o... ... ... ...o... ... ... ... ...o... ...o... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... .....o. . .o. . . .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..oo oo. .. .. .. .. .. .. o........................................o .... .... .... ....oo.... ....
.... .... .... .... .... .... .... .... .... .... .... .... ....o....o.... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... ......................................oo .. .. .. .. ... ... ... ... ...oo... ... ... ... ... ... ... ...oo.. ....o.... o.... .... .... .... .... .... .... .... .... ....
.... .... ....o.... .... .... .... .... .... .... .... .... .... .... .... .... ....... o... ... ... ...o... ... ... ... ...o... ... o... ... o...o... ... ... o. . . .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..oo..................o.. .. .. .. .. .. ..
.. .. .. ..o.. .. .. .. .. .. ... . . . . . . .ooo. . . . . . . ... ... ... ... ... ... ... ... ... ...o... .... .... .... o.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..o o .....o..... ..... .....o..... o..... .....oo... o... ... ... ... ...o... ... ...
... ...oo... ... ... ..... ..... ..... ..... o..... ..... ..... .....o.. .. .. o.. .. .. .. .. .. ..o.. ... ... ... ... ... ... ...ooo.............................oo. .. ... ... ... ... ... ... ... ... ... ... ... o.. o.. .. .. .. .. .. .. .. .. .. .. .. .. o.. .. o..o.. .. .. .. .. .. .. .. .. ..o. . . . .
.o.oo.o..o.. .. o..o.. o.. .. .. .. .. .. .. ..o.. ..o.. .. .. ..o.. .. .. ..o.. .. .. o.. o.. .. .. .. .. .. .. .. .. .. .. .. o. .. .. .. .. .. .. ...o.. .. .. .. .. o.. .. .. .. .. .. .. ... ... ... ... ... ... ..... .. .. .. ..o.. oo... ...o... ... ... ... ... ... ... ... ... ... ... ... ... ... ... oo....o.... .... ....oo....
oo. .. .. .. .. .. .. .. .. .. .. .. .. ..o............ ... ... ... ... ... ... ... ... ... ...o.........oo... ... ... ... ... ...o... ... ... ... ... ... ... ... ... ... ... ... ...o... ... ... ... ... ... ... ... ... ... ...o... ...o... o... ... o... ... ... ... o... ... .... .... .... .... .... .... o.. .. .. .. .. .. .. .. ..