MulaiMulai sekarang secara 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.

Latihan ini adalah bagian dari kursus

Credit Risk Modeling in Python

Lihat Kursus

Petunjuk latihan

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

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# 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'].____())
Edit dan Jalankan Kode