Assessing gradient boosted trees
So you've now used XGBClassifier()
models to predict probability of default. These models can also use the .predict()
method for creating predictions that give the actual class for loan_status
.
You should check the model's initial performance by looking at the metrics from the classification_report()
. Keep in mind that you have not set thresholds for these models yet.
The data sets cr_loan_prep
, X_test
, and y_test
have already been loaded in the workspace. The model clf_gbt
has been loaded as well. The classification_report()
for the logistic regression will print automatically.
This exercise is part of the course
Credit Risk Modeling in Python
Exercise instructions
- Predict the
loan_status
values for theX
test data and store them ingbt_preds
. - Check the contents of
gbt_preds
to see predictedloan_status
values not probabilities of default. - Print a
classification_report()
of the model's performance againsty_test
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Predict the labels for loan status
____ = clf_gbt.____(____)
# Check the values created by the predict method
print(____)
# Print the classification report of the model
target_names = ['Non-Default', 'Default']
print(classification_report(____, ____, target_names=target_names))