【发布时间】:2022-11-28 21:38:07
【问题描述】:
我正在尝试使用以下代码绘制使用随机森林算法生成的特征重要性。
但是,最大值显示在底部。但我希望他们处于领先地位。
feat_importances = pd.Series(g_search.best_estimator_.feature_importances_, index=X_train.columns)
feat_importances.nlargest(20).plot(kind='barh')
您可以在下图中看到所有大值都在底部。但是,我希望它们出现在图表的顶部。
为什么输出以相反的顺序显示?
【问题讨论】:
标签: python pandas matplotlib machine-learning plot