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)What the rule reports
Section titled “What the rule reports”Calls to TreeExplainer(...) that pass approximate=.
How to fix it
Section titled “How to fix it”Remove approximate= from TreeExplainer(...) and pass it to explainer(X, approximate=True) or explainer.shap_values(X, approximate=True).
Diagnostic message
Section titled “Diagnostic message”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.