CommencerCommencer gratuitement

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.

Cet exercice fait partie du cours

Credit Risk Modeling in Python

Afficher le cours

Instructions

  • 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().

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Print the top 5 rows of the new data frame
print(____.____())

# Create a subset of only accepted loans
____ = ____[____['pred_loan_status'] == ____]

# Calculate the bad rate
print(np.____(____['true_loan_status']) / ____['true_loan_status'].____())
Modifier et exécuter le code