Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Purpose of decay parameter in nnet function in R?

Tags:

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?

like image 313
user395882 Avatar asked Feb 22 '12 06:02

user395882


2 Answers

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)

like image 81
blahdiblah Avatar answered Oct 23 '22 01:10

blahdiblah


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.

like image 6
AronNeewart Avatar answered Oct 22 '22 23:10

AronNeewart