Credit Risk Modeling in Python
Michael Crabtree
Data Scientist, Ford Motor Company
classification_report()
and compareSample of loans | Average predicted PD | Sample percentage of actual defaults | Calibrated? |
---|---|---|---|
10 | 0.12 | 0.12 | Yes |
10 | 0.25 | 0.65 | No |
calibration_curve()
from sklearn.calibration import calibration_curve
calibration_curve(y_test, probabilities_of_default, n_bins = 5)
# Fraction of positives
(array([0.09602649, 0.19521012, 0.62035996, 0.67361111]),
# Average probability
array([0.09543535, 0.29196742, 0.46898465, 0.65512207]))
plt.plot(mean_predicted_value, fraction_of_positives, label="%s" % "Example Model")
Credit Risk Modeling in Python