Hello, I guess the error might be due to the struture of your dataset.
Try this: data(iris) iris1<-iris iris1[iris1$Species=="setosa","Output"]<- 1 iris1[iris1$Species=="versicolor","Output"]<- 0 #Here, if you set "virginica" to 2, still it runs, with a warning message "-- response is not binary". I also run it without setting values for viriginica ,i.e. NA, it didn't gave any error or warnings. iris1[iris1$Species=="virginica","Output"]<- 0 nn1<-neuralnet(Output~Sepal.Length+Sepal.Width+Petal.Length+Petal.Width,data=iris1,hidden=2,err.fct="ce",linear.output=FALSE) plot(nn1) nn1$result.matrix 1 error 0.018911271401 reached.threshold 0.009459417063 steps 92.000000000000 Intercept.to.1layhid1 -4.353018230633 Sepal.Length.to.1layhid1 1.720240396708 Sepal.Width.to.1layhid1 -6.428901709134 Petal.Length.to.1layhid1 3.273018763978 Petal.Width.to.1layhid1 7.110403675648 Intercept.to.1layhid2 4.815489181151 Sepal.Length.to.1layhid2 -0.123278321659 Sepal.Width.to.1layhid2 6.348589101327 Petal.Length.to.1layhid2 -6.376680199897 Petal.Width.to.1layhid2 -8.065600706230 Intercept.to.Output -0.224816723130 1layhid.1.to.Output -9.042646714781 1layhid.2.to.Output 8.799061406981 str(iris1) 'data.frame': 150 obs. of 6 variables: $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... $ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ... $ Output : num 1 1 1 1 1 1 1 1 1 1 ... Hope it helps you. A.K. ----- Original Message ----- From: Rahul Bhalla <rahulbhalla_3...@yahoo.com> To: "r-help@r-project.org" <r-help@r-project.org> Cc: Sent: Wednesday, August 1, 2012 1:51 PM Subject: [R] Neuralnet Error I require some help in debugging this code library(neuralnet) ir<-read.table(file="iris_data.txt",header=TRUE,row.names=NULL) ir1 <- data.frame(ir[1:100,2:6]) ir2 <- data.frame(ifelse(ir1$Species=="setosa",1,ifelse(ir1$Species=="versicolor",0,""))) colnames(ir2)<-("Output") ir3 <- data.frame(rbind(ir1[1:4],ir2)) #rownames(ir3)<-c("SL","SW","PL","PW","Output") print(ir3) n<- neuralnet(Output~Sepal.Length+Sepal.Width+Petal.Length+Petal.Width,data=ir3,err.fct="sse",hidden=2,linear.output=FALSE) Output: Error in neurons[[i]] %*% weights[[i]] : requires numeric/complex matrix/vector arguments Any assisstance is appreciated [[alternative HTML version deleted]] ______________________________________________ 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. ______________________________________________ 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.