No slash command · from anofox-tabfm
Evaluates predictions using the anofox_tabfm DuckDB extension with classification metrics (accuracy, precision, recall, F1, ROC-AUC, log loss, ECE, confusion matrix), regression metrics (RMSE, MAE, R-squared, MAPE, MedAE), proper scoring rules (CRPS, log score, interval score), and leakage-safe k-fold cross-validation.
Ships in anofox-tabfm. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Extension: anofox_tabfm v2026.12.05 | DuckDB: v1.5.6 / v2.0 | Dual naming: tabfm_* and anofox_tabfm_* (identical)
The metrics are model-agnostic SQL aggregates over plain (actual, predicted[, proba]) columns: they score
any model's output, not only this extension's.
avg is required for tabfm_precision, tabfm_recall, tabfm_f1 ('micro', 'macro',
'weighted') and tabfm_roc_auc ('ovr', 'ovo'). Leaving it out is an error, not a default.VARCHAR labels and a MAP(VARCHAR, DOUBLE): tabfm_log_loss,
tabfm_roc_auc, tabfm_ece. That is exactly tabfm_classify's proba; cast the label with ::VARCHAR
(a BOOLEAN target's keys are 'true' / 'false').tabfm_cross_validate takes no model :=. Set anofox_tabfm_default_model first. task is
'classification' (default) or 'regression'; anything else ('auto', a typo) is an error. A numeric
target that is a quantity needs task := 'regression', or the folds are classified and the call fails
on the class limit with an error that says so.STRUCT(logits DOUBLE[], borders DOUBLE[]). tabfm_regress
does not emit one yet, so they score distributions you construct or get from elsewhere, and they are not
usable in cross-validation.NULL rows are skipped; NaN operands of the regression metrics are skipped too, Infinity is an
error. The VARCHAR-label metrics cannot tell a numeric NaN from the string 'nan'.SELECT tabfm_accuracy(actual, predicted) AS acc,
tabfm_precision(actual, predicted, avg := 'macro') AS prec,
tabfm_recall(actual, predicted, avg := 'macro') AS rec,
tabfm_f1(actual, predicted, avg := 'macro') AS f1,
tabfm_roc_auc(actual, proba, avg := 'ovr') AS auc, -- rank-sum, tie-safe
tabfm_log_loss(actual, proba) AS logloss, -- epsilon-clipped
tabfm_ece(actual, proba) AS ece -- top-label calibration error
FROM scored;
tabfm_accuracy, tabfm_precision, tabfm_recall and tabfm_f1 take labels of any type (actual and
predicted the same type). Per model: add GROUP BY model.
Confusion matrix, tidy (actual, predicted, count):
SELECT * FROM tabfm_confusion_matrix('scored', 'actual', 'predicted');
DOUBLE)SELECT tabfm_rmse(actual, predicted) AS rmse,
tabfm_mae(actual, predicted) AS mae,
tabfm_r2(actual, predicted) AS r2, -- constant-target safe
tabfm_mape(actual, predicted) AS mape, -- skips zero-actual rows
tabfm_medae(actual, predicted) AS medae
FROM scored_regression;
dist is STRUCT(logits DOUBLE[], borders DOUBLE[]): a softmax'd bar distribution, len(borders) = len(logits) + 1, non-uniform bin widths honoured. A point estimate instead of a distribution is a bind error
naming the remedy.
SELECT tabfm_crps(actual, dist) AS crps, -- closed form
tabfm_log_score(actual, dist) AS nll,
tabfm_interval_score(actual, dist, 0.9) AS is90 -- 3rd argument: coverage, default 0.9
FROM predictions;
Deterministic, seedable folds (hash(row_key, seed) % k). Each fold is predicted from the others through the
train / test form, so no row ever sees its own label.
tabfm_cross_validate(data, target, row_key [, k := 5] [, seed := 42] [, task := 'classification'] [, metric])
tabfm_fold_assign(data, k, row_key, seed)
| argument | meaning |
|---|---|
data | table name or '(SELECT ...)' |
target | column to predict |
row_key | a unique key column; it decides the folds and joins the labels back. Passed through with keep, so it is not a feature |
k, seed | folds and the hash seed |
task | 'classification' (default) or 'regression'; anything else is an error |
metric | 'tabfm_accuracy' (classification default), 'tabfm_rmse' (regression default), 'tabfm_mae', 'tabfm_r2' |
Output fold_id, metric_value, metric_std: one row per fold (metric_std NULL) and a summary row with
fold_id = -1 holding the mean and the standard deviation.
SET anofox_tabfm_default_model = 'mitra';
SELECT * FROM tabfm_cross_validate('customers', 'churned', 'id', k := 5, seed := 42);
SELECT * FROM tabfm_cross_validate('sold_homes', 'price', 'home_id', k := 3,
task := 'regression', metric := 'tabfm_mae');
Comparing models by CV means one run per model, switching the default:
SET anofox_tabfm_default_model = 'mitra';
CREATE TABLE cv AS
SELECT 'mitra' AS model, metric_value, metric_std
FROM tabfm_cross_validate('customers', 'churned', 'id', k := 5) WHERE fold_id = -1;
SET anofox_tabfm_default_model = 'tabicl-v2';
INSERT INTO cv
SELECT 'tabicl-v2', metric_value, metric_std
FROM tabfm_cross_validate('customers', 'churned', 'id', k := 5) WHERE fold_id = -1;
SELECT * FROM cv ORDER BY metric_value DESC;
tabfm_fold_assign returns every input column plus fold_id (and a helper column _cv_rk), for your own
fold loops, e.g. metrics that tabfm_cross_validate does not offer. Drop both helper columns and pass the
key through keep, or they become features (the test fold's fold_id is a value no context row has):
CREATE TABLE fa AS SELECT * FROM tabfm_fold_assign('customers', 5, 'id', 42);
-- one fold (fold 0); repeat per fold, or generate the UNION ALL
SELECT 0 AS fold, tabfm_f1(c.churned::VARCHAR, p.yhat::VARCHAR, avg := 'macro') AS f1
FROM tabfm_classify('(SELECT * EXCLUDE (fold_id, _cv_rk) FROM fa WHERE fold_id <> 0)', 'churned',
test := '(SELECT * EXCLUDE (fold_id, _cv_rk) FROM fa WHERE fold_id = 0)',
keep := ['id'], model := 'mitra') p
JOIN customers c USING (id);
Cost: CV is k predict calls per model, each over (k-1)/k of the rows; use k := 3 on large tables. Comparing
more models than anofox_tabfm_max_sessions (default 4) reloads sessions between runs.
Stack each model's predictions with a model column; every metric then works GROUP BY model.
-- the held-out labels, wherever they live
CREATE TABLE truth AS SELECT id AS customer_id, churned FROM customers WHERE id > 30;
CREATE TABLE cmp AS
SELECT 'mitra' AS model, t.churned::VARCHAR AS actual, p.yhat::VARCHAR AS yhat, p.proba
FROM tabfm_classify('history', 'churned', test := 'prospects', keep := ['customer_id'], model := 'mitra') p
JOIN truth t USING (customer_id)
UNION ALL
SELECT 'tabicl-v2', t.churned::VARCHAR, p.yhat::VARCHAR, p.proba
FROM tabfm_classify('history', 'churned', test := 'prospects', keep := ['customer_id'], model := 'tabicl-v2') p
JOIN truth t USING (customer_id);
SELECT model, tabfm_accuracy(actual, yhat) AS acc, tabfm_roc_auc(actual, proba, avg := 'ovr') AS auc
FROM cmp GROUP BY model ORDER BY auc DESC;
_by macros)Six table macros turn scored rows into the long tables anofox_plot(t) from the
anofox-visualization extension draws, one group per
model. Arguments after data are column names as strings.
| macro | gives | draws |
|---|---|---|
tabfm_classification_metrics_by(data, group_col, actual_col, predicted_col, proba_col) | accuracy, ece, f1_macro, log_loss, roc_auc_ovr per group | model comparison |
tabfm_regression_metrics_by(data, group_col, actual_col, predicted_col) | mae, mape, medae, r2, rmse per group | model comparison |
tabfm_confusion_matrix_by(data, group_col, actual_col, predicted_col) | row (actual), col (predicted), value (count), zero cells included | heatmap per model |
tabfm_augment_by(data, group_col, actual_col, predicted_col [, row_id_col]) | y, fitted, residual per row | residual diagnostics |
tabfm_roc_curve_by(data, group_col, actual_col, proba_col [, pos_label, drop_intermediate]) | ROC curve, one-vs-rest per class | ROC curves with AUC |
tabfm_calibration_curve_by(data, group_col, actual_col, proba_col [, pos_label, n_bins]) | reliability curve per class, 95% Wilson band | calibration curves |
Metric tables: model, model_id, metric, value, conf_low, conf_high, row_order. Curves: model, model_id, series, curve_type, x, y, y_low, y_high, threshold, weight, n_censor, row_order. Every macro ends with
row_order, the 1-based order the rows come out in.
SELECT * FROM tabfm_classification_metrics_by('scored', 'model', 'actual', 'yhat', 'proba');
SELECT * FROM tabfm_regression_metrics_by('scored_regression', 'model', 'actual', 'predicted');
SELECT * FROM tabfm_roc_curve_by('scored', 'model', 'actual', 'proba', pos_label := 'yes');
With the visualization loaded:
INSTALL anofox_visualization FROM community; LOAD anofox_visualization;
SELECT anofox_plot(t) FROM tabfm_classification_metrics_by('scored', 'model', 'actual', 'yhat', 'proba') t;
SELECT model_id, anofox_plot(t) FROM tabfm_confusion_matrix_by('scored', 'model', 'actual', 'yhat') t
GROUP BY model_id; -- one heatmap per model
SELECT anofox_plot(t) FROM tabfm_roc_curve_by('scored', 'model', 'actual', 'proba') t;
Curves and classes: two classes give one curve per model (for the greater label, scikit-learn's
classes_[1]), so models compare in one plot. More classes give one curve per class (series); plot those
one model at a time (GROUP BY model_id). pos_label := '<class>' draws one class. The calibration curve
bins each class's probability while tabfm_ece bins the top-label confidence, so they do not give the same
number. A metric undefined for a group (ROC-AUC with one class present) is left out.
SET anofox_tabfm_default_model = 'mitra';
-- 1. how good is it, without a held-out split: 5-fold CV
SELECT metric_value AS accuracy, metric_std
FROM tabfm_cross_validate('customers', 'churned', 'id', k := 5) WHERE fold_id = -1;
-- 2. a held-out split for richer metrics
CREATE TABLE ctx AS SELECT * FROM customers WHERE hash(id) % 10 < 7;
CREATE TABLE hold AS SELECT * FROM customers WHERE hash(id) % 10 >= 7;
CREATE TABLE ev AS
SELECT 'mitra' AS model, h.churned::VARCHAR AS actual, p.yhat::VARCHAR AS yhat, p.proba
FROM tabfm_classify('ctx', 'churned', test := 'hold', keep := ['id']) p
JOIN hold h USING (id);
-- 3. the numbers, and the long table to plot
SELECT tabfm_f1(actual, yhat, avg := 'macro') AS f1, tabfm_log_loss(actual, proba) AS logloss,
tabfm_ece(actual, proba) AS ece
FROM ev;
SELECT * FROM tabfm_classification_metrics_by('ev', 'model', 'actual', 'yhat', 'proba');
What SKILL.md sets; muted values are Claude Code's defaults
5 skills in this plugin
/anofox-tabfm-generateSynthetic tabular data and missing-value imputation with the anofox_tabfm DuckDB extension: `tabfm_generate` samples new rows that keep the relationships between columns, `tabfm_impute` fills NULL cells conditioned on the rest of each row, both zero-shot from a tabular foundation model. Use when creating synthetic or augmented rows, upsampling a rare segment, filling NULLs in a table, choosing generation options (seed, temperature, bins, column_order, rounds), or checking the fidelity and limits of generated data.
/anofox-tabfm-gpuGPU acceleration and device control for the anofox_tabfm DuckDB extension: NVIDIA CUDA and AMD ROCm (both served by the ggml GPU plugin) and Apple MLX backend plugins loaded at runtime, device discovery, per-model backend support, precision modes and GPU memory. Use when making predictions faster on a GPU, running `tabfm_accelerate` / `tabfm_download_runtime`, reading `tabfm_devices()` / `tabfm_backends()`, setting `anofox_tabfm_device`, `anofox_tabfm_gpu_precision` or `anofox_tabfm_ep_path`, checking which device actually served a query, or troubleshooting a GPU that is not used.
/anofox-tabfm-modelsChoosing, downloading and managing models for the anofox_tabfm DuckDB extension: the 27 built-in tabular foundation models (Mitra, TabPFN 2 / 2.5 / 2.6 / 3 / 3.5, TabICL v2, TabDPT, LimiX-2 and 2M, Kumo-Tabular, Inpriora, EXAONE, Nori, Orion, Causilo, Google TabFM), their licences and commercial use, the licence gate, Hugging Face tokens, and registering your own ONNX model. Use when picking a model, running `tabfm_download` / `tabfm_load` / `tabfm_unload` / `tabfm_remove`, reading `tabfm_list_models()` or `tabfm_models()`, setting `anofox_tabfm_default_model` or `anofox_tabfm_accept_hf_license`, calling `tabfm_register_model`, tuning the context cache, or checking whether a model may be used commercially.
npx claudepluginhub datazoode/anofox-tabfm --plugin anofox-tabfmOther plugins' skills for the same job