[R] Help on NNET

sbinny sbinny at sina.com
Thu Jul 17 00:25:15 CEST 2003


Hi, Dear all,

I am just starting using R in my work and got some trouble to figure out some of the errors. Can anybody help me?

The following is the script:

read.csv('pupil.txt',header=TRUE,sep='\t')->pupil
samp<-c(1:50, 112:162, 171:220, 228:278)
pupil.nn2 <- nnet(Type ~ ., data = pupil, subset = samp, size = 2, rang = 0.1, decay = 5e-4, maxit = 200)
table(pupil$Type[-samp], predict(pupil.nn2, pupil[-samp,], type = "class"))

After running this, I got error information as

#Error in switch(type, raw = z, class = { : 
#        inappropriate fit for class

BTW, pupil.txt
X1   X2  Type
0.2  0.5  0
...........
..........
.........1
.........
.........
..........2
.......
........3
........
there are totally 351 records. 
My objective is to classify them into 4 classes.

Thanks a lot for your help!




More information about the R-help mailing list