Skip to content
Back to skills

Counterfactuals And Similarity

ASecurity

"Routes Alibi requests for Counterfactual, CEM,

  • 247 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 8, 2026
developmentgoapibackend

Works with

  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill counterfactuals-and-similarity --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Counterfactuals And Similarity?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Counterfactuals And Similarity
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-counterfactuals-and-similarity/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-counterfactuals-and-similarity)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: counterfactuals-and-similarity
description: "Routes Alibi requests for Counterfactual, CEM,
  CounterfactualProto, CounterfactualRL, and GradientSimilarity workflows and
  their backend gating."
disable-model-invocation: true
metadata:
  disco-role: operating
license: NOASSERTION
---

# Counterfactuals and Similarity

Use this sub-skill when a user wants to generate counterfactual examples or compare instances with gradient-based similarity.

## Trigger phrases

Open this sub-skill when the user mentions:

- counterfactual explanations or recourse
- CEM, Counterfactual, or CounterfactualProto
- CounterfactualRL or CFRL
- GradientSimilarity or similarity explanations
- TensorFlow 1.x vs 2.x compatibility, torch backend choice, or gradient memory pressure

## What this sub-skill owns

- `Counterfactual`
- `CEM`
- `CounterfactualProto`
- `CounterfactualRL`
- `CounterfactualRLTabular`
- `GradientSimilarity`

## What it does not own

- global tabular explainers
- anchors
- SHAP / IntegratedGradients
- confidence scores or prototype summarization as a standalone family
- save/load guidance

## Read next

- `references/workflows.md` for the backend and method matrix
- `references/api-reference.md` for the verified Counterfactual, CEM, CFProto, CFRL, and GradientSimilarity signatures
- `references/backend-notes.md` for TF / Torch selection guidance
- `references/troubleshooting.md` for known counterfactual and similarity failures
- `scripts/check_optional_counterfactual_backends.py` before promising a runtime path

## Typical flow

1. Decide whether the request is a basic counterfactual, a prototype-guided counterfactual, or a similarity explanation.
2. Check whether the requested backend is TensorFlow or Torch and whether the environment already has it.
3. If the user only needs to know why the workflow is unavailable, run the diagnostic script instead of attempting a full training run.
4. Use the workflow reference to explain the backend and tensor shape expectations.

## Good fits

- recourse-style counterfactuals on tabular or image-like data
- TF/Keras counterfactual search with gradient support
- model-similarity workflows that use gradients over parameters

## Common failure signals

- TF1-style counterfactual methods collide with TF2-only workflows
- the model is a tree and the method expects differentiability
- the CFRL decoder does not return a list of tensors for tabular data
- similarity workflows run out of memory when precomputing gradients
- the requested backend is not installed yet

Files in this skill

  • SKILL.md2.5 KB
  • references/api-reference.md3 KB
  • references/backend-notes.md1.4 KB
  • references/troubleshooting.md1.9 KB
  • references/workflows.md2.6 KB
  • scripts/check_optional_counterfactual_backends.py1.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.