[英]understanding per class variable importance in 'randomForest' R package
[英]Variable importance plot using randomforest package in R
我创建了一个random forest model
现在想看看变量的重要性。 在尝试这样做时,它只显示MeanDecreaseGini
plot,而不是MeanDecreaseAccuracy
plot。如果我尝试指定type = 1
,它会给出错误提示
imp[, i] 错误:下标越界
但是type = 2
不会发生同样的情况。
我使用的代码是:
RF_Model<- randomForest(as.factor(Ash )~B1+B2+B3+B4+B5+B6+B7+B8+B9+B10+B11+B12+B13+B14+B15
+B16+B17+B18+B19+B20, data=Subset, ntree=2000, Importance=TRUE)
print(RF_Model)
Important=RF_Model$importance
View( Important).
谁能帮我解决这个问题?
它应该是importance=TRUE
而不是Importance=TRUE
。 请参阅下面的可重现示例:
rf = randomForest(Species ~ .,data=iris,Importance=TRUE)
importance(rf,type=1)
Sepal.Length
Sepal.Width
Petal.Length
Petal.Width
rf = randomForest(Species ~ .,data=iris,importance=TRUE)
importance(rf,type=1)
MeanDecreaseAccuracy
Sepal.Length 10.035280
Sepal.Width 4.849584
Petal.Length 32.512948
Petal.Width 34.386394
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.