SHARE
TWEET

Untitled

a guest Dec 15th, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top