[R] nnet behaving oddly

Liaw, Andy andy_liaw at merck.com
Tue Oct 21 15:07:13 CEST 2003


> From: Rajarshi Guha [mailto:rxg218 at psu.edu] 
> 
> Hi,
>   I was trying to use the nnet library and am not sure of 
> whats going on. I am calling the nnet function as:
> 
>  n <- nnet(x,y,size=3,subset=sets[[1]], maxit=200)

Please give us output of something like:

str(x)
summary(y)

Also, I believe the subset argument is only meant for calls via 
formula; e.g.,

nnet(y ~ x, ...)

and needs to be a vector of logicals the same length as the number
of rows in x, indicating which rows to include in the fitting.
Please also tell us what sets[[1]] is.

Andy
 
> Where x is a 272x4 matrix of observations (examples) and y is 
> a 272x1 matrix of target values. However when I look at 
> nnet$residuals they are off by two orders of magnitude 
> (compared to the output from neural network code that I 
> already have). Looking at nnet$fitted.values shows all the 
> values to be 1 (whereas my target values range from 0 to 150).
> 
> Am I making an obvious mistake in the way I'm calling the 
> function? Is the fact that n$fitted.values is all 1's 
> indicating that the NN is doing a classification? If so how 
> can I make it do quantitation?
> 
> The man page mentions that if the response is a factor then 
> it defaults to quantitation. However my y matrix just contain 
> numbers - so it should'nt be doing classification.
> 
> Any pointers would be appreciated.
> 
> Thanks,
> 
> -------------------------------------------------------------------
> Rajarshi Guha <rxg218 at psu.edu> <http://jijo.cjb.net>
> GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
> -------------------------------------------------------------------
> Psychology is merely producing habits out of rats.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list 
> https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
>




More information about the R-help mailing list