Session Ready
Exercise

Acceptance rates

Setting an acceptance rate and calculating the threshold for that rate can be used to set the percentage of new loans you want to accept. For this exercise, assume the test data is a fresh batch of new loans. You will need to use the quantile() function from numpy to calculate the threshold.

The threshold should be used to assign new loan_status values. Does the number of defaults and non-defaults in the data change?

The trained model clf_gbt and the data frame of it's predictions, test_pred_df, are available.

Instructions
100 XP
  • Print the summary statistics of prob_default within the data frame of predictions using .describe().
  • Calculate the threshold for a 85% acceptance rate using quantile() and store it as threshold_85.
  • Create a new column called pred_loan_status based on threshold_85.
  • Print the value counts of the new values in pred_loan_status.