Agent skill
ce-classification
Handle CE classification workflows for binary and multiclass prediction semantics and class-focused explanation behavior.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/ce-classification
SKILL.md
CE Classification
You are working with a classification task (binary or multiclass). CE provides calibrated probability bounds $[p_{low}, p_{high}]$ using Venn-Abers calibration.
Prediction Semantics (Venn-Abers)
The predict and predict_proba methods return calibrated class assignments
and probabilities.
- Binary: Rules and probabilities always refer to the positive class (index 1).
- Multiclass:
predict(): Returns the class label with the highest calibrated probability.predict_proba(): Returns a full probability distribution (summing to 1).
- Intervals: For any class probability $p$, the calibrated interval $[p_{low}, p_{high}]$ guarantees that $p_{low} \le p \le p_{high}$ (ADR-021 invariant).
# Multiclass: explain the PREDICTED class (default)
# If the model predicts 'Class 2', rules explain 'Why Class 2?'
explanations = explainer.explain_factual(X_test)
Explaining All Classes (multi_labels_enabled)
By default, CE explains the predicted class. To explain all classes
(e.g., for contrastive analysis or true multi-label tasks), use
multi_labels_enabled=True.
# Returns a MultiClassCalibratedExplanations object
multi_explanations = explainer.explain_factual(
X_test,
multi_labels_enabled=True
)
MultiClassCalibratedExplanations API
This object stores a mapping of {class_index: Explanation} for each instance.
# 1. Access instance i (returns a specialized multi-class view for instance i)
inst_exps = multi_explanations[i]
# 2. Access a specific class explanation for instance i
# Returns a standard FactualExplanation or AlternativeExplanation
class_1_exp = multi_explanations[i, 1]
# 3. Plotting
# Plots all class explanations for the instance
multi_explanations[i].plot()
Task-Specific Config
When fitting the explainer, CE automatically detects binary vs multiclass based
on y_proper. Use explainer.class_labels to check the detected labels.
explainer = WrapCalibratedExplainer(model)
explainer.fit(x_p, y_p)
explainer.calibrate(x_c, y_c)
print(f"Task: {explainer.task}") # 'classification'
print(f"Labels: {explainer.class_labels}") # e.g., ['Setosa', 'Versicolor', 'Virginica']
Contributor & Agent Checklist
- Binary index — remember that binary classification in CE is always
relative to
class 1. - Multi-label type — use
multi_labels_enabled=True(plurallabels) to trigger the multiclass explanation logic. - Invariant check — verify
low <= predict <= highfor any class probability being inspected. - Labels in titles — when plotting multiclass, ensure class labels (not
just indices) are used if available in
explainer.class_labels.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?