[R] how to get actual value from predict in nnet?

From: Baoqiang Cao <caobg_at_email.uc.edu>
Date: Thu 28 Jul 2005 - 05:33:06 EST

Dear All,

After followed the help of nnet, I could get the networks trained and, excitedly, get the prediction for other samples. It is a two classes data set, I used "N" and "P" to label the two. My question is, how do I get the predicted numerical value for each sample? Not just give me the label(either "N" or "P")? Thanks!

FYI: The nnet example I followed from help document is,  ird <- data.frame(rbind(iris3[,,1], iris3[,,2], iris3[,,3]),

             species = c(rep("s",50), rep("c", 50), rep("v", 50)))
     ir.nn2 <- nnet(species ~ ., data = ird, subset = samp, size = 2, rang = 0.1,
                    decay = 5e-4, maxit = 200)
     table(ird$species[-samp], predict(ir.nn2, ird[-samp,], type = "class"))

Best regards,
 Baoqiang Cao

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jul 28 05:44:17 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:34:06 EST