Python में क्रेडिट रिस्क मॉडलिंग
Michael Crabtree
Data Scientist, Ford Motor Company
# कुछ विशेष कॉलम चुनता है
X_multi = cr_loan_prep[['loan_int_rate','person_emp_length']]
# loan_status को छोड़कर बाकी सारा डेटा चुनता है
X = cr_loan_prep.drop('loan_status', axis = 1)
.get_booster() और .get_score() मेथड्स का उपयोग करें# मॉडल ट्रेन करें
clf_gbt.fit(X_train,np.ravel(y_train))
# फीचर importances प्रिंट करें
clf_gbt.get_booster().get_score(importance_type = 'weight')
{'person_home_ownership_RENT': 1, 'person_home_ownership_OWN': 2}
# importance_type = 'weight' से कॉलम importances
{'person_home_ownership_RENT': 1, 'person_home_ownership_OWN': 2}
plot_importance() फंक्शन का उपयोग करेंxgb.plot_importance(clf_gbt, importance_type = 'weight')
{'person_income': 315, 'loan_int_rate': 195, 'loan_percent_income': 146}
| Columns | Importances | Model Accuracy | Model Default Recall |
|---|---|---|---|
| loan_int_rate, person_emp_length | (100, 100) | 0.81 | 0.67 |
| loan_int_rate, person_emp_length, loan_percent_income | (98, 70, 5) | 0.84 | 0.52 |
classification_report() का हिस्सा रूप में दिखता हैPython में क्रेडिट रिस्क मॉडलिंग