Greetings,
I am having trouble calculating artificial neural network misclassification
errors using errorest() from the ipred package. I have had no problems
estimating the values with randomForest() or svm(), but can't seem to get it
to work with nnet(). I believe this is due to the output of the
predict.nnet() function within cv.factor(). Below is a quick example of the
problem I'm experiencing. Any ideas on how to get around it or will it
simply not work with nnet()?
library(MASS)
library(nnet)
library(ipred)
data(iris3)
set.seed(191)
samp <- c(sample(1:50,25), sample(51:100,25), sample(101:150,25))
ird <- data.frame(rbind(iris3[,,1], iris3[,,2], iris3[,,3]),
+ ? ? ? ? species = factor(c(rep("s",50), rep("c", 50), rep("v", 50))))
errorest(species ~., data = ird, subset = samp, model = nnet, size = 2,
rang =0.1, decay = 5e-4, maxit = 200)
# weights: ?19
initial ?value 73.864441
.
.
.
final ?value 0.339114
converged
Error in cv.factor(y, formula, data, model = model, predict = predict, ?:
?predict does not return factor values
Thanks,
Dave