如何获得ranklib生成的随机森林模型的特征重要性?

How to get the feature importance of ranklib generated random forests model?

使用ranklib's learning to rank random forests generates an xml-like model. Ranklib has a tool that provides features'频率,不一定被认为是特征重要性。

如何获取ranklib生成的随机森林的Gini特征重要性或Gini指数?如何解析生成的树?

在 Sourceforge 讨论论坛中发现 you need to parse the model file yourself

就我个人而言,为了从 ranklib 随机森林中获得特征的基尼重要性,我经历了很多努力,并最终成功了。这里分享一下我为解决问题所做的Github repository

你可以通过运行这个命令来完成(使用python3):

python Gini.py <num_features> <path_to\training_data> <path_to\RF_model> <trees directory> <output_file>

请查看存储库以获取有关如何操作的更多详细信息。