rules/shap/linear-explainer-deprecated-perturbation.md
feature_perturbation= on shap.LinearExplainer is deprecated and emits a FutureWarning in favor of passing an explicit masker (shap.maskers.Independent, shap.maskers.Impute, or shap.maskers.Partition).
diff
| 1 | -explainer = shap.LinearExplainer(model, X_train, feature_perturbation="interventional") |
| 2 | +explainer = shap.LinearExplainer(model, shap.maskers.Independent(X_train)) |
What the rule reports
Calls to LinearExplainer(...) passing a non-None feature_perturbation=.
How to fix it
Wrap the background data in shap.maskers.Independent(X_train) for interventional SHAP or shap.maskers.Impute(X_train) for correlation-dependent SHAP.