Dearest all, Objective: I am now learning neural networks. I want to see how well can train an artificial neural network model to discriminate between the two files I am attaching with this message.
http://r.789695.n4.nabble.com/file/n2240582/3dMaskDump.txt 3dMaskDump.txt http://r.789695.n4.nabble.com/file/n2240582/test_vowels.txt test_vowels.txt Question: when I am attempting to run >cvc_nnet <- nnet(G ~ ., data=cvc_lda, size=1,iter=10,MaxNWts=100) I get an error saying: Error in as.data.frame.default(x[[i]], optional = TRUE) : cannot coerce class c("terms", "formula") into a data.frame I have not encountered this error when I was running this script with previous lda results, and, I am not quite sure what the error means. Below is short (and, I hope, reproducible) code. library(nnet) cvc_nnet <- nnet(G ~ ., data=cvc_lda, size=1,iter=10,MaxNWts=100) predict(cvc_nnet,cvc_lda,type = "class") table(predict(cvc_nnet,cvc_lda,type = "class"),cvc_lda$G) cvc_nnet.out<-NULL all = c(1:52) for(n in all){ cvc_nnet <- nnet(G ~ ., data=cvc_lda[all != n,], CV =TRUE,size=1,iter=10,MaxNWts=100) cvc_nnet.out <- c(cvc_nnet.out,predict(cvc_nnet,cvc_lda[all == n,],type = "class")) } table(cvc_nnet.out,cvc_lda$G) === to get cvc_lda: library(MASS) vowel_features <- data.frame(as.matrix(read.table(file = "test_vowels.txt"))) mask_features <- data.frame(as.matrix(read.table(file = "3dmaskdump.txt"))) G <-vowel_features[,41] cvc_lda <- lda(G ~ ., data=mask_features, na.action="na.omit", CV=TRUE) Your insight is very much appreciated it! -- View this message in context: http://r.789695.n4.nabble.com/nnet-cannot-coerce-class-c-terms-formula-into-a-data-frame-tp2240582p2240582.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@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.