简体   繁体   中英

Purpose of decay parameter in nnet function in R?

I am using nnet function in R to train my neural network. I am not getting what is decay parameter in nnet is? Is this step size to be used in gradient descent mentod or regularization parameter used to overcome overfitting?

It's regularization to avoid over-fitting.

From the documentation (pdf) :

decay: parameter for weight decay. Default 0.

Further information is available in the authors' book, Modern Applied Statistics with S. Fourth Edition , page 245:

One way to ensure that f is smooth is to restrict the class of estimates, for example, by using a limited number of spline knots. Another way is regularization in which the fit criterion is altered to

E + λC(f)

with a penalty C on the 'roughness' of f . Weight decay, specific to neural networks, uses as penalty the sum of squares of the weights wij. ... The use of weight decay seems both to help the optimization process and to avoid over-fitting . (emphasis added)

Complementing blahdiblah 's answer by looking at the source code I think that parameter weights corresponds to the learning rate of back-propagation (by reading the manual I couldn't understand what it was). Look at the file nnet.c , line 236 , inside function fpass :

TotalError += wx * E(Outputs[i], goal[i - FirstOutput]);

here, in a very intuitive nomenclature, E corresponds to the bp error and wx is a parameter passed to the function, which eventually corresponds to the identifier Weights[i] .

Also you can be sure that the parameter decay is indeed what it claims to be by going to the lines 317~319 of the same file, inside function VR_dfunc :

for (i = 0; i < Nweights; i++)
    sum1 += Decay[i] * p[i] * p[i];
*fp = TotalError + sum1;

where p corresponds to the connections' weights, which is the exact definition of the weight-decay regularization.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM