interpret/blackbox-background-from-test
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| interpret | warning | none, edit by hand | All versions |
InterpretML blackbox explainers (LimeTabular, ShapKernel, MorrisSensitivity, PartialDependence) use their data argument to estimate feature distributions, sampling bounds, and baseline expectations. Passing holdout or test rows leaks test distribution statistics into the explainer.
explainer = LimeTabular(model, X_test)explainer = LimeTabular(model, X_train)What the rule reports
Section titled “What the rule reports”Calls to LimeTabular, ShapKernel, MorrisSensitivity, or PartialDependence passing a test- or holdout-named variable as the second positional argument or data=.
How to fix it
Section titled “How to fix it”Pass training or development background rows (X_train) when constructing the explainer, then call explain_local(X_val, y_val) on validation rows.
Diagnostic message
Section titled “Diagnostic message”Passing test or holdout rows ($BG) as the InterpretML blackbox explainer background dataset leaks holdout distribution statistics into perturbations and baselines. Pass training background rows instead.See all rules in the interpret pack.