[R] passing arguments from nnet to optim

Tarca, Adi atarca at med.wayne.edu
Fri Aug 26 16:41:48 CEST 2005


Hi everyone,
According to R reference manual, the nnet function uses the BFGS method
of optim to optimize the neural network parameters.
I would like, when calling the function nnet to tell the optim function
not to produce the tracing information on the progress of the
optimization, or at least to reduce the frequency of the reports.
I tried the following:
a) nnet default
> x<-rnorm(20)
> y<-seq(0,1,length=20)
> s<-nnet(y~x,size=1)
# weights:  4
initial  value 1.910932 
iter  10 value 1.819382
iter  20 value 1.788736
iter  30 value 1.775778
iter  40 value 1.767771
iter  50 value 1.765063
iter  60 value 1.762631
iter  70 value 1.760670
iter  80 value 1.759349
iter  90 value 1.757801
iter 100 value 1.756290
final  value 1.756290 
stopped after 100 iterations

Report is generated at every 10 iterations.

b) passing the REPORT parameter to optim via the control argument
> x<-rnorm(20)
> y<-seq(0,1,length=20)
> s<-nnet(y~x,size=1,control=list(REPORT=50))
# weights:  4
initial  value 1.894905 
iter  10 value 1.672337
iter  20 value 1.658612
iter  30 value 1.654824
iter  40 value 1.653465
iter  50 value 1.652785
iter  60 value 1.652343
iter  70 value 1.652116
iter  80 value 1.651860
iter  90 value 1.651525
iter 100 value 1.651292
final  value 1.651292 
stopped after 100 iterations

Is still producing reports at each 10 iterations. 
Has anyone an idea how can I turn off the report generation or at least
to reduce its frequency?
Thanks,
Adi L. TARCA




More information about the R-help mailing list