Mapping column names to random forest feature importances

后端 未结 4 1248
-上瘾入骨i
-上瘾入骨i 2021-02-04 12:28

I am trying to plot feature importances for a random forest model and map each feature importance back to the original coefficient. I\'ve managed to create a plot that shows the

4条回答
  •  情书的邮戳
    2021-02-04 13:18

    It is simple, I plotted it like this.

    feat_importances = pd.Series(extraTree.feature_importances_, index=X.columns)
    feat_importances.nlargest(15).plot(kind='barh')
    plt.title("Top 15 important features")
    plt.show()
    
    

提交回复
热议问题