Skip to content

Instantly share code, notes, and snippets.

@fclesio
Created January 13, 2020 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fclesio/317b7716e5c0c06132aa44f3c9075e9b to your computer and use it in GitHub Desktop.
Save fclesio/317b7716e5c0c06132aa44f3c9075e9b to your computer and use it in GitHub Desktop.
features_list = [str(x + 0) for x in range(estimator.n_features_)]
features_list
# >>> ['0', '1', '2', '3', '4', '5', '6', '7', '8']
importances = estimator.feature_importances_
indices = np.argsort(importances)
plt.figure(1)
plt.title(‘Feature Importances’)
plt.barh(range(len(indices)), importances[indices], color=b’, align=center’)
plt.yticks(range(len(indices)), indices)
plt.xlabel(‘Relative Importance’)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment