decision-model-calibration
БесплатноБез исполняемых скриптовНе проверенTurning a model's class probabilities into numbers you can set a threshold on: building the labelled corpus, measuring accuracy and calibration honestly (ECE…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
Calibrating decision models
Deep Knowledge: Use
mcp__documentation__fetch_docswith technology:decision-calibrationand one of these topics:
calibration: ECE variants, debiased estimators, isotonic and vector scaling, bootstrap CIs, contextual calibration.order-bias: position and label bias, flip-rate measurement, PriDe.conformal: LAC, APS and RAPS, plus class-conditional coverage.provider-logprobs: request examples for each provider.eval-harness: a complete runnable harness that compares Jev with an LLM on your own corpus and writes the decision report.
A probability is useful only if "0.9" means right about nine times in ten on
your data. No vendor can promise that for you: calibration depends on your
inputs, your language and your label set, and it shifts with every model
version. This skill is the procedure; typed-decision-models has the evidence
about Jev in particular. The code below was run on simulated data with known
over-confidence before it was written here (Python 3.12, numpy 2.5, scipy 1.18,
scikit-learn 1.9.1).
1. The corpus comes first
It outlives every model you try against it, and it is the only thing that lets you compare them.
- Draw from production traffic, not from what is easy to label. Same language, same state shape, same class balance — and include the ambiguous cases, which are the ones thresholds exist for.
- Size. About 50 labels per question can fit a one-parameter correction; fewer than ~30 can make calibration worse (observed on Jev). Isotonic regression needs on the order of 1,000 (scikit-learn warns against it when the number of calibration samples is "too low (≪1000)"). Thresholds for rare, expensive classes need enough examples of that class.
- Split into a calibration half and a test half; never report a metric on the data a correction was fitted on.
- Label what a person on the team would do, not what the model said. A corpus labelled by another model measures agreement, not correctness — the exact flaw in the Jev launch benchmark.
- Record the model version alongside every stored probability, so a re-tune can be triggered when it changes.
2. Measure
import numpy as np
def ece(confidence, correct, n_bins=10):
"""Expected calibration error with equal-mass bins (less biased than equal-width)."""
confidence = np.asarray(confidence, float)
correct = np.asarray(correct, float)
order = np.argsort(confidence)
total = len(confidence)
return sum(
len(b) / total * abs(correct[b].mean() - confidence[b].mean())
for b in np.array_split(order, n_bins)
if len(b)
)
def ece_noise_floor(confidence, n_bins=10, n_sims=2000, seed=0):
"""ECE a *perfectly calibrated* model would show on this many items with these
confidences. A measured ECE inside this band is indistinguishable from noise."""
rng = np.random.default_rng(seed)
confidence = np.asarray(confidence, float)
sims = [ece(confidence, rng.random(confidence.size) < confidence, n_bins) for _ in range(n_sims)]
return np.percentile(sims, [50, 95])
def brier(probs, labels):
"""Multiclass Brier score; probs is (n, k), labels are column indices."""
probs = np.asarray(probs, float)
onehot = np.eye(probs.shape[1])[labels]
return np.mean(np.sum((probs - onehot) ** 2, axis=1))
Report, per question:
- accuracy with a confidence interval. n = 77 gives roughly ±10 points;
- ECE next to its noise floor. The floor depends on n and on how spread
the confidences are: at n = 60 a perfectly calibrated model scores a median
≈ 0.06 when confidences cluster near 1, but ≈ 0.13 when they spread over
0.4–1 (simulated with
ece_noise_floor). A bare ECE is uninterpretable; - Brier score, which punishes both miscalibration and poor discrimination;
- direction: is the error over-confident (most binned accuracy below binned confidence) or compressed toward the middle?
What "confidence" means:
- Choice: use
p_max, or the probability of the chosen option. - Noul: use
max(p, 1 − p), with correctness judged at your threshold.
Do not calibrate Jev's confidence field. It is a dispersion statistic
derived from the distribution ((p_max − 1/n)/(1 − 1/n) for Choice), not a
probability. Calibrate probabilities or noul.
3. Fit
Choice / Score: one temperature
from scipy.optimize import minimize_scalar
from scipy.special import softmax
# Jev rounds probabilities to 0.01 and returns exact zeros. log(0) is -inf, and a
# tiny floor (1e-6) turns every zero into a huge negative logit that inflates the
# fitted temperature. Half the rounding quantum is the honest floor.
FLOOR = 0.005
def to_matrix(answers, options):
"""[{'billing': 0.88, ...}, ...] -> (n, k) array in a fixed option order."""
return np.array([[a[o] for o in options] for a in answers], float)
def fit_temperature(pr
Установить decision-model-calibration в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditBashFAQ
Что делает скилл decision-model-calibration?
Turning a model's class probabilities into numbers you can set a threshold on: building the labelled corpus, measuring accuracy and calibration honestly (ECE with a noise floor, Brier, risk–coverage), fitting temperature/Platt, removing option-order bias, conformal prediction sets, and choosing per-action thresholds. Applies to Jev and any typed classifier with probabilities, and says which LLM providers expose logprobs at all. USE WHEN: user asks whether a confidence/probability can be trusted, how to pick a threshold, about "calibration", "ECE", "reliability diagram", "temperature scaling", "Platt", "isotonic", "CalibratedClassifierCV", "conformal prediction", "abstain", "selective prediction", "risk coverage", "position bias", "option order", "logprobs", or wants to evaluate Jev or an LLM classifier against labels. DO NOT USE FOR: training classifiers from scratch, or generic LLM evals of free-text output (no class probabilities to calibrate).
Как установить скилл decision-model-calibration?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл decision-model-calibration запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic