Skip to content

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)

Calls to LimeTabular, ShapKernel, MorrisSensitivity, or PartialDependence passing a test- or holdout-named variable as the second positional argument or data=.

Pass training or development background rows (X_train) when constructing the explainer, then call explain_local(X_val, y_val) on validation rows.

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.