shap/linear-explainer-deprecated-perturbation
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| shap | warning | none, edit by hand | All versions |
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).
explainer = shap.LinearExplainer(model, X_train, feature_perturbation="interventional")explainer = shap.LinearExplainer(model, shap.maskers.Independent(X_train))What the rule reports
Section titled “What the rule reports”Calls to LinearExplainer(...) passing a non-None feature_perturbation=.
How to fix it
Section titled “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.
Diagnostic message
Section titled “Diagnostic message”feature_perturbation= on shap.LinearExplainer is deprecated and emits a FutureWarning. Pass shap.maskers.Independent(data) or shap.maskers.Impute(data) as the masker instead.See all rules in the shap pack.