Skip to content

shap/tree-explainer-deprecated-approximate

Pack Severity Fix Versions
shap warning none, edit by hand All versions

Passing approximate= to shap.TreeExplainer(...) has been deprecated since SHAP 0.47. Pass approximate= when computing SHAP values instead.

explainer = shap.TreeExplainer(model, approximate=True)
sv = explainer(X_val)
explainer = shap.TreeExplainer(model)
sv = explainer(X_val, approximate=True)

Calls to TreeExplainer(...) that pass approximate=.

Remove approximate= from TreeExplainer(...) and pass it to explainer(X, approximate=True) or explainer.shap_values(X, approximate=True).

The approximate= constructor argument on shap.TreeExplainer is deprecated and emits a DeprecationWarning. Pass approximate= to explainer(X, approximate=...) or explainer.shap_values(X, approximate=...) instead.

See all rules in the shap pack.