[R] how to get actual value from predict in nnet?
caobg at email.uc.edu
Wed Jul 27 21:33:06 CEST 2005
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"))
More information about the R-help