features_list = train_cols
feature_importance = gbm_encoder_val.feature_importance()
sorted_idx = np.argsort(feature_importance)
sns.set_style("dark")
plt.figure(figsize=(12,10))
plt.grid(True,)
plt.barh(range(len(sorted_idx)), feature_importance[sorted_idx], 0.5)
plt.yticks(range(len(sorted_idx)), np.array(train_cols)[sorted_idx])
plt.rcParams['font.size'] =16
plt.rcParams['font.sans-serif'] = ['Times New Roman'] #用于刻度font
plt.xlim(0,50000)
plt.title('Feature importance',font)
plt.draw()
plt.savefig('F:DataFolder/coal/pics/feature_importances.jpg')
plt.show()
feature_importance
网友评论