Created
August 3, 2018 20:59
-
-
Save ImadDabbura/666662672683733882356fe91b2b31e8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # fit RF to plot feature importances | |
| rf_clf.fit(RobustScaler().fit_transform( | |
| Imputer(strategy="median").fit_transform(X_train)), y_train) | |
| # Plot features importance | |
| importances = rf_clf.feature_importances_ | |
| indices = np.argsort(rf_clf.feature_importances_)[::-1] | |
| plt.figure(figsize=(12, 6)) | |
| plt.bar(range(1, 25), importances[indices], align="center") | |
| plt.xticks(range(1, 25), | |
| df.columns[df.columns != "not_fully_paid"][indices], | |
| rotation=90) | |
| plt.title("Feature Importance", {"fontsize": 16}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment