IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Credit Risk Modeling in Python

Visualizza il corso

Istruzioni dell'esercizio

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

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# 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'].____())
Modifica ed esegui il codice