简体   繁体   中英

R_function Nnet_How can I solve the following error “the object (list) can not be automatically converted in integer”?

I am trying to use a neural network algorithm to solve a statistical problem. When I call the function Nnet (software R) with the following parameters :

rn=nnet(resignation~., data=T[,-1], entropy=T, size=5, decay=1, MaxNWts=3000, maxit=1000)

I have the error below, and I don't succeed to understand the meaning of this error and how to solve it:

weights: 2656

Error in nnet.default(x, y, w, ...) : l'objet (list) ne peut être converti automatiquement en un type 'integer'

Error in nnet.default(x, y, w, ...) : the object (list) can not be automatically converted to an 'integer' type

Could you please help me ?

I remain available for any further information Thanks

It appears that the main problem is the fact that you use the name T as your data frame name. As a consequence, the value received by the entropy argument is a list (data frames can be seen as lists in R) instead of a boolean (or integer). To make it work, run this instead:

rn=nnet(Species~., data=T[,-1], entropy=TRUE, size=5, decay=1, MaxNWts=3000, maxit=1000)

NB: I would suggest you not to use T as a variable name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM