Medial Code Documentation
Loading...
Searching...
No Matches
Variables
tree_shap Namespace Reference

Variables

 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
 

Detailed Description

Use GPU to speedup SHAP value computation
=========================================

Demonstrates using GPU acceleration to compute SHAP values for feature importance.

Variable Documentation

◆ param

dict tree_shap.param
Initial value:
1= {
2 "eta": 0.05,
3 "max_depth": 10,
4 "tree_method": "hist",
5 "device": "cuda",
6}