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.
Deze oefening maakt deel uit van de cursus
Credit Risk Modeling in Python
Oefeninstructies
- Print the first five rows of the predictions data frame.
- Create a subset called
accepted_loanswhich only contains loans where the predicted loan status is0. - Calculate the bad rate based on
true_loan_statusof the subset usingsum()and.count().
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# 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'].____())