[R] R: optim problems and neural networks
Allan at STATS.uct.ac.za
Mon Dec 13 17:16:57 CET 2004
i have two questions:
1. i have been having problems with using the "optim" function. I have
tried to define the matrix containing the parameters as a matrix, ie not
simply p*1. The function does not allow this. Am i correct?
2. in the code below i have tried to calculate the weights of a basic
feed forward neural network (I know that i could use the nnet package.).
the aim is to learn how to code and become familiar with the language.
note that the code still has to be generalised and does not allow for
skip layers. No error checking on the parameter estimates are included
yet. when i run the above code, i get the following error, "Error in
fn(par, ...) : recursive default argument reference ". why does this
happen? As a simple case, use x<-c(1,2,3) and y<-2+3*x. I know that
there is no errors. I simply want the code to work at this stage.
#the input to hidden layer section
#the hidden layer to output section
# the square of the residuals
# the sums of squares / 2
More information about the R-help