Python ile Kredi Riski Modellemesi
Michael Crabtree
Data Scientist, Ford Motor Company
# Belirli birkaç sütunu seçer
X_multi = cr_loan_prep[['loan_int_rate','person_emp_length']]
# loan_status hariç tüm verileri seçer
X = cr_loan_prep.drop('loan_status', axis = 1)
.get_booster() ve .get_score() metotlarını kullanın# Modeli eğit
clf_gbt.fit(X_train,np.ravel(y_train))
# Özellik önemlerini yazdır
clf_gbt.get_booster().get_score(importance_type = 'weight')
{'person_home_ownership_RENT': 1, 'person_home_ownership_OWN': 2}
# importance_type = 'weight' için sütun önemleri
{'person_home_ownership_RENT': 1, 'person_home_ownership_OWN': 2}
plot_importance() fonksiyonunu kullanınxgb.plot_importance(clf_gbt, importance_type = 'weight')
{'person_income': 315, 'loan_int_rate': 195, 'loan_percent_income': 146}
| Sütunlar | Önemler | Model Doğruluğu | Model Varsayılan Geri Çağırma |
|---|---|---|---|
| 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() çıktısının bir parçası olarak görünürPython ile Kredi Riski Modellemesi