R中的错误(mice包),权重过多

9

我在使用库“mice”的函数进行缺失值插补时遇到了以下错误:


 Error in nnet.default(X, Y, w, mask = mask, size = 0, skip = TRUE, softmax = TRUE,  :
too many (1104) weights

问题由mice.impute.polrmice.impute.polyreg函数生成,因为默认权重最大数量的限制。 我无法使用命令substitute 解决它,也不能复制功能代码并编写新功能mice.impute.polrmice.impute.polyreg(因为我找不到调用augment函数)。 有人告诉我应该去源代码中修改它。
如何操作?还有其他解决方案吗?
3个回答

10
The neural net function called by mice() is stopping because the "maximum allowable number of weights" has been exceeded. The MaxNWts argument to nnet is there to prevent running code that will take a very long time to complete.
If you don't mind waiting then you can increase the MaxNWts parameter by passing it directly to mice(), which will be picked up by nnet(): mice(data = df_with_nas, MaxNWts = 2000)

5
通过nnet.MaxNWts参数增加小鼠的最大NWts。
mice(data = df_with_nas, nnet.MaxNWts = 2000)

这在老鼠插补函数的文档中有描述,例如mice.impute.polr。


-1

我曾经遇到过同样的问题。我发现有一个因子变量有超过10个级别。当我删除了这个变量后,错误就消失了。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接