简体   繁体   English

R_function Nnet_如何解决以下错误“对象(列表)无法自动转换为整数”?

[英]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 : 当我使用以下参数调用函数Nnet(软件R)时:

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 重量:2656

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

Error in nnet.default(x, y, w, ...) : the object (list) can not be automatically converted to an 'integer' type nnet.default(x,y,w,...)中的错误:无法将对象(列表)自动转换为“整数”类型

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. 似乎主要的问题是您使用名称T作为数据帧名称。 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). 结果, entropy参数接收的entropy是一个列表(数据帧可以看成R中的列表),而不是布尔值(或整数)。 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. 注意:我建议您不要将T用作变量名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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