[R] nnet inappropriate fit for class error

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jun 1 07:44:12 CEST 2011


On Tue, 31 May 2011, Duygu Gunaydin wrote:

> Hi,
>
> I am trying to run a nnet algorithm but when I try to use the predict function with type='class', it gives the following error:
>
> fit <- nnet(y~., size = 1, data = train.set, rang = 0.5, maxit=200, decay = 0)
>
> predict<-predict(fit,test.set,type='class')
> Error in predict.nnet(fit, test.set, type = "class") :
> inappropriate fit for class
>
> I couldn't figure out the reason for this, are there any specifications to use type='class' that I am missing?

Please see the footer of this message.   Very likely 'y' was not a 
factor, but we haven't been told what it is.

>
> Thank you,
>
> Duygu Gunaydin
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list