6. Gradient Boosting, XGBoost, and SHAP Values
Activity 6.01: Modeling the Case Study Data with XGBoost and Explaining the Model with SHAPÂ
Solution:
In this activity, we'll take what we've learned in this chapter with a synthetic dataset and apply it to the case study data. We'll see how an XGBoost model performs on a validation set and explain the model predictions using SHAP values. We have prepared the dataset for this activity by replacing the samples that had missing values for the PAY_1
feature, that we had previously ignored, while maintaining the same train/test split for the samples with no missing values. You can see how the data was prepared in the Appendix to the notebook for this activity.
- Load the case study data that has been prepared for this exercise. The file path is
../../Data/Activity_6_01_data.pkl
and the variables are:features_response, X_train_all, y_train_all, X_test_all, y_test_all
...