Mapping column names to random forest feature importances

后端 未结 4 1249
-上瘾入骨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

    I use a similar solution to Sam:

    import pandas as pd
    important_features = pd.Series(data=brf.feature_importances_,index=x_dummies.columns)
    important_features.sort_values(ascending=False,inplace=True)
    

    I always just print the list using print important_features but to plot you could always use Series.plot

提交回复
热议问题