shap/linear-explainer-removed-feature-dependence
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| shap | error | none, edit by hand | All versions |
feature_dependence= was removed from shap.LinearExplainer and raises ValueError. Choose correlation handling through shap.maskers.Independent or shap.maskers.Impute.
explainer = shap.LinearExplainer(model, X_train, feature_dependence="correlation_dependent")explainer = shap.LinearExplainer(model, shap.maskers.Impute(X_train))What the rule reports
Section titled “What the rule reports”Calls to LinearExplainer(...) passing feature_dependence=.
How to fix it
Section titled “How to fix it”Remove feature_dependence= and wrap the background data in shap.maskers.Independent(X_train) or shap.maskers.Impute(X_train).
Diagnostic message
Section titled “Diagnostic message”feature_dependence= was removed from shap.LinearExplainer and raises ValueError. Pass shap.maskers.Independent(data) or shap.maskers.Impute(data) as the masker instead.See all rules in the shap pack.