क्रेडिट मॉडल प्रदर्शन

Python में क्रेडिट रिस्क मॉडलिंग

Michael Crabtree

Data Scientist, Ford Motor Company

मॉडल एक्यूरेसी स्कोरिंग

  • एक्यूरेसी निकालें

एक्यूरेसी का सूत्र

  • scikit-learn की .score() मेथड इस्तेमाल करें
# टेस्ट डेटा पर एक्यूरेसी जाँचें
clf_logistic1.score(X_test,y_test)
0.81
  • loan_status के 81% मान सही प्रेडिक्ट हुए
Python में क्रेडिट रिस्क मॉडलिंग

ROC कर्व चार्ट

  • Receiver Operating Characteristic कर्व
    • true positive rate (sensitivity) बनाम false positive rate (fall-out) प्लॉट करता है
fallout, sensitivity, thresholds = roc_curve(y_test, prob_default)
plt.plot(fallout, sensitivity, color = 'darkorange')

ROC चार्ट का उदाहरण

Python में क्रेडिट रिस्क मॉडलिंग

ROC चार्ट का विश्लेषण

  • Area Under Curve (AUC): कर्व और रैंडम प्रेडिक्शन के बीच का एरिया

लिफ्ट और AUC के एनोटेशन वाला ROC चार्ट उदाहरण

Python में क्रेडिट रिस्क मॉडलिंग

डिफॉल्ट थ्रेशोल्ड

  • थ्रेशोल्ड: किस बिंदु पर कोई probability डिफॉल्ट मानी जाए

प्रोबेबिलिटी थ्रेशोल्ड का आरेख

Python में क्रेडिट रिस्क मॉडलिंग

थ्रेशोल्ड सेट करना

  • हमारे 0.5 थ्रेशोल्ड के आधार पर लोन को रीलैबल करें
preds = clf_logistic.predict_proba(X_test)
preds_df = pd.DataFrame(preds[:,1], columns = ['prob_default'])
preds_df['loan_status'] = preds_df['prob_default'].apply(lambda x: 1 if x > 0.5 else 0)

प्रोबेबिलिटीज और लोन स्टेटस के साथ डेटा सैंपल

Python में क्रेडिट रिस्क मॉडलिंग

क्रेडिट क्लासिफिकेशन रिपोर्ट

  • scikit-learn में classification_report()
from sklearn.metrics import classification_report
classification_report(y_test, preds_df['loan_status'], target_names=target_names)

क्लासिफिकेशन रिपोर्ट का उदाहरण

Python में क्रेडिट रिस्क मॉडलिंग

क्लासिफिकेशन मेट्रिक्स चुनना

  • classification_report() से चुने हुए कॉम्पोनेन्ट चुनें और स्टोर करें
  • scikit-learn की precision_recall_fscore_support() फंक्शन का उपयोग करें

डिफॉल्ट रिकॉल के साथ क्लासिफिकेशन रिपोर्ट का उदाहरण

from sklearn.metrics import precision_recall_fscore_support
precision_recall_fscore_support(y_test,preds_df['loan_status'])[1][1]
Python में क्रेडिट रिस्क मॉडलिंग

अभ्यास करते हैं!

Python में क्रेडिट रिस्क मॉडलिंग

Preparing Video For Download...