Get startedGet started for free

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.

This exercise is part of the course

Credit Risk Modeling in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Print the classification report
target_names = ['Non-Default', 'Default']
print(____(____, ____[____], target_names=target_names))
Edit and Run Code