Threshold selection
You know there is a trade off between metrics like default recall, non-default recall, and model accuracy. One easy way to approximate a good starting threshold value is to look at a plot of all three using matplotlib
. With this graph, you can see how each of these metrics look as you change the threshold values and find the point at which the performance of all three is good enough to use for the credit data.
The threshold values thresh
, default recall values def_recalls
, the non-default recall values nondef_recalls
and the accuracy scores accs
have been loaded into the workspace. To make the plot easier to read, the array ticks
for x-axis tick marks has been loaded as well.
This exercise is part of the course
Credit Risk Modeling in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
plt.plot(____,____)
plt.plot(____,____)
plt.plot(____,____)
plt.xlabel("Probability Threshold")
plt.xticks(ticks)
plt.legend(["Default Recall","Non-default Recall","Model Accuracy"])
plt.____()