我目前正在使用随机森林模型中的递归特征消除来进行特征选择。结果证明具有交叉验证的最佳特征数量。但是,我也想知道这些输入功能的原始等级。
代码在这里:
control <- rfeControl(functions=rfFuncs, method="cv", number=20)
# run the RFE algorithm
results <- rfe(df[,1:53], df[,54], sizes=c(1:53), rfeControl=control)
# summarize the results
print(results)
# list the chosen features
predictors(results)
# plot the results
plot(results, type=c("g", "o"))
输出:
Variables Accuracy Kappa AccuracySD KappaSD Selected
1 0.7881 0.5817 0.1435 0.2707
2 0.8714 0.7273 0.1402 0.2908
3 0.8202 0.6043 0.1595 0.3266
4 0.8286 0.6214 0.1645 0.3674
5 0.8286 0.6130 0.1814 0.3989
6 0.8357 0.6302 0.1624 0.3353
7 0.8440 0.6321 0.1266 0.2955
8 0.8690 0.6991 0.1385 0.3141
9 0.8607 0.6878 0.1456 0.3279
predictors(results) #only showed feature identity within optimal number
然后,在最佳数量之后,我应该如何知道特征的身份?任何帮助将不胜感激。