1. Learn
  2. /
  3. Courses
  4. /
  5. Credit Risk Modeling in Python

Exercise

Selecting report metrics

The classification_report() has many different metrics within it, but you may not always want to print out the full report. Sometimes you just want specific values to compare models or use for other purposes.

There is a function within scikit-learn that pulls out the values for you. That function is precision_recall_fscore_support() and it takes in the same parameters as classification_report.

It is imported and used like this:

# Import function
from sklearn.metrics import precision_recall_fscore_support
# Select all non-averaged values from the report
precision_recall_fscore_support(y_true,predicted_values)

The cr_loan_prep data set along with the predictions in preds_df have already been loaded in the workspace.

Instructions 1/3

undefined XP
    1
    2
    3
  • Print the classification report for y_test and predicted loan status.