Exercise

Total expected loss

It's time to estimate the total expected loss given all your decisions. The data frame test_pred_df has the probability of default for each loan and that loan's value. Use these two values to calculate the expected loss for each loan. Then, you can sum those values and get the total expected loss.

For this exercise, you will assume that the exposure is the full value of the loan, and the loss given default is 100%. This means that a default on each the loan is a loss of the entire amount.

The data frame test_pred_df has been loaded into the workspace.

Instructions

100 XP
  • Print the top five rows of test_pred_df.
  • Create a new column expected_loss for each loan by using the formula above.
  • Calculate the total expected loss of the entire portfolio, rounded to two decimal places, and store it as tot_exp_loss.
  • Print the total expected loss.