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.
Questo esercizio fa parte del corso
Credit Risk Modeling in Python
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
# Print the classification report
target_names = ['Non-Default', 'Default']
print(____(____, ____[____], target_names=target_names))