Last active
April 2, 2019 22:17
-
-
Save bfraiche/b7745787cad3a54cb6018d9769517378 to your computer and use it in GitHub Desktop.
This gist contains code snippets for my blogpost: 'Random Forest with Python and Spark ML'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bestPipeline = cvModel.bestModel | |
bestModel = bestPipeline.stages[1] | |
importances = bestModel.featureImportances | |
x_values = list(range(len(importances))) | |
plt.bar(x_values, importances, orientation = 'vertical') | |
plt.xticks(x_values, feature_list, rotation=40) | |
plt.ylabel('Importance') | |
plt.xlabel('Feature') | |
plt.title('Feature Importances') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment