|
| data = fetch_california_housing() |
|
| X = data.data |
|
| y = data.target |
|
int | num_round = 500 |
|
dict | param |
|
| dtrain = xgb.DMatrix(X, label=y, feature_names=data.feature_names) |
|
| model = xgb.train(param, dtrain, num_round) |
|
| shap_values = model.predict(dtrain, pred_contribs=True) |
|
| shap_interaction_values = model.predict(dtrain, pred_interactions=True) |
|
| explainer = shap.TreeExplainer(model) |
|
| feature_names |
|
| matplotlib |
|
| plot_type |
|
Use GPU to speedup SHAP value computation
=========================================
Demonstrates using GPU acceleration to compute SHAP values for feature importance.