Exercise

Bad rates

With acceptance rate in mind, you can now analyze the bad rate within the accepted loans. This way you will be able to see the percentage of defaults that have been accepted.

Think about the impact of the acceptance rate and bad rate. We set an acceptance rate to have fewer defaults in the portfolio because defaults are more costly. Will the bad rate be less than the percentage of defaults in the test data?

The predictions data frame test_pred_df has been loaded into the workspace.

Instructions

100 XP
  • Print the first five rows of the predictions data frame.
  • Create a subset called accepted_loans which only contains loans where the predicted loan status is 0.
  • Calculate the bad rate based on true_loan_status of the subset using sum() and .count().