Anchors for Local Explanations
Use this sub-skill when a user wants an anchor rule that explains a specific prediction on tabular data, text, or images.
Trigger phrases
Open this sub-skill when the user mentions:
- anchors or anchor rules
- AnchorTabular, AnchorText, or AnchorImage
- precision, coverage, beam search, or
threshold - text sampling strategies such as
unknown,similarity, orlanguage_model - image segmentation, superpixels, or custom
segmentation_fn
What this sub-skill owns
AnchorTabularAnchorTextAnchorImage- the text sampling helpers and image-segmentation guidance needed to use them
What it does not own
- SHAP or integrated gradients
- counterfactual methods
- confidence scores or prototype selection
- save/load guidance
Read next
references/workflows.mdfor the tabular / text / image route mapreferences/api-reference.mdfor the verified AnchorTabular, AnchorText, and AnchorImage signaturesreferences/anchor-text.mdfor text-specific sampling detailsreferences/troubleshooting.mdfor input-shape and dependency failuresscripts/check_spacy_model.pybefore using a text anchor workflowscripts/smoke_anchor_tabular.pyandscripts/smoke_anchor_image.pyfor safe CPU smokes
Typical flow
- Decide whether the anchor is tabular, text, or image.
- Make sure the predictor accepts the input type the method expects.
- For tabular data, fit the explainer on a representative training set.
- For text, decide whether
nlporlanguage_modelsampling is the right perturbation strategy. - For images, choose a segmentation strategy that returns sensible superpixels.
- Use the smoke scripts on tiny synthetic inputs before trying a larger example.
Good fits
- local explanations for a single prediction
- a rule-based explanation with high precision and explicit coverage
- tabular, text, or image workflows where the user wants human-readable conditions
Common failure signals
- the predictor is not batched or does not accept the right input type
- AnchorTabular was not fitted before
explain - AnchorText is missing a spaCy model or the
language_modelpath is not installed - image segmentation returns the wrong shape or type
- the result is empty or far too long because the instance sits near a decision boundary