简体   繁体   English

如何解决R的重要性

[英]How to solve for importance in R

When I typed the command for importance as below importance ( model.rf ) I get this error: 当我输入重要性命令如下重要性( model.rf )时,我收到此错误:

Error in UseMethod("importance") : no applicable method for 'importance' applied to an object of class "c('randomForest.formula', 'randomForest')" UseMethod中的错误(“重要性”):对于“c('randomForest.formula','randomForest')”对象的“重要性”没有适用的方法“

How to solve this error? 如何解决这个错误?

output.forest <- randomForest(nativeSpeaker ~ age + shoeSize + score,  data = 
readingSkills,importance=TRUE)
#You can use like this - Solution
out.importance <- round(importance(output.forest), 2)
print(out.importance )

first convert importance to variable and then print that out. 首先将重要性转换为变量,然后将其打印出来。

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

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