Guest User

Untitled

a guest
Dec 15th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #random forest feature importance
  2. import matplotlib.pyplot as plt
  3.  
  4. for f in range(x_train.shape[1]):
  5. print("%d. feature %d (%f)" % (f + 1, indices[f], importances[indices[f]]))
  6.  
  7. # Plot the feature importances of the forest
  8. plt.figure(1, figsize=(14, 13))
  9. plt.title("Feature importances")
  10. plt.bar(range(x_train.shape[1]), importances[indices], color="g", yerr=std[indices], align="center")
  11. plt.xticks(range(x_train.shape[1]), x_train.columns[indices],rotation=90)
  12. plt.xlim([-1, x_train.shape[1]])
  13.  
  14. plt.show()
Add Comment
Please, Sign In to add comment