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.
Diese Übung ist Teil des Kurses
Credit Risk Modeling in Python
Anleitung zur Übung
- Predict the
loan_statusvalues for theXtest data and store them ingbt_preds. - Check the contents of
gbt_predsto see predictedloan_statusvalues not probabilities of default. - Print a
classification_report()of the model's performance againsty_test.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# 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))