Created
May 5, 2020 09:02
-
-
Save abhishek-shrm/c0ee8f64e2e4b0d88f8512126091a5e5 to your computer and use it in GitHub Desktop.
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
feature_importance=pd.DataFrame({ | |
'rfc':rfc.feature_importances_, | |
'dt':dt.feature_importances_ | |
},index=df.drop(columns=['Loan_ID','Loan_Status']).columns) | |
feature_importance.sort_values(by='rfc',ascending=True,inplace=True) | |
index = np.arange(len(feature_importance)) | |
fig, ax = plt.subplots(figsize=(18,8)) | |
rfc_feature=ax.barh(index,feature_importance['rfc'],0.4,color='purple',label='Random Forest') | |
dt_feature=ax.barh(index+0.4,feature_importance['dt'],0.4,color='lightgreen',label='Decision Tree') | |
ax.set(yticks=index+0.4,yticklabels=feature_importance.index) | |
ax.legend() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment