Local-only CLI for Pasteur tabular simulation and evaluation. It makes no network calls: it reads and writes only the local paths you pass. For a full worked example, see Choosing between models; for metric definitions, see Reading the results.
Install:
npx -y @krv-labs/pasteur --help # prebuilt; or npm install -g @krv-labs/pasteur
cargo install pasteur-cli # build from sourceThe npm package @krv-labs/pasteur (Node.js ≥ 18) installs the same binary as pasteur-cli and pasteur; prebuilt binaries are also on each GitHub release. For Claude Code, see the plugin install.
Input schemas (clean parquet, labels table) are documented in Data Contracts. For security and data handling, see Security.
Build from source:
cargo build -p pasteur-cli
# or
cargo run -p pasteur-cli -- --help- Unit tests:
#[cfg(test)] mod testsat the bottom ofcli/src/**/*.rs(when a module needs them). - Integration tests:
cli/tests/(e.g.cli_local.rs) for subprocess/CLI workflows.
Run: cargo test -p pasteur-cli.
Run Blackout, Jitter, Flipper, and Sweep simulators over a local clean parquet. Scramble and Units run only when their rate flag is given.
pasteur-cli simulate \
--input ./input/clean.parquet \
--labels ./labels/groups.parquet \
--output ./output \
--id-col node_id \
--feature TSH \
--blackout-companion TSH_measured \
--blackout-rate 0.1 \
--jitter-iters 3 \
--flipper-pairs 200 \
--flipper-steps 20| Flag | Default | Description |
|---|---|---|
--input |
(required) | Local clean parquet |
--labels |
— | Group-membership parquet (schema) for flipper pair sampling (omit to skip flipper). Classifiers only |
--targets, --target-col |
— | Regression: targets parquet and its target column (schema) |
--targets-id-col |
node_id |
Regression: ID column of --targets, matched as text |
--output |
output |
Root for sim-type folders |
--dataset-name |
— | Provenance label for logs |
--id-col |
node_id |
Row id column (becomes source_row_id) |
--feature |
TSH |
Feature for blackout/jitter/scramble/units |
--blackout-companion |
— | Column nulled together with --feature (repeatable). Without it a blacked-out assay keeps its _measured == 1 flag — a row no EHR emits |
--blackout-rate |
0.1 |
Blackout mask rate |
--jitter-scale |
1.0 |
Jitter noise scale |
--jitter-iters |
3 |
Number of jitter_<i> variants |
--scramble-rate |
— | Fraction of --feature rows written as messy text; enables scramble (the column becomes text) |
--scramble-encoding |
all | Repeatable: numeric-text, censored, unit-suffix, sentinel |
--unit-rate |
— | Fraction of rows converted; enables units with exactly one of --unit-preset or --unit-factor |
--unit-preset |
— | Named conversion, e.g. glucose_mgdl_to_mmoll (list) |
--unit-factor, --unit-offset |
—, 0 |
Custom conversion value * factor + offset |
--site |
— | Site file (JSON): blackout, scramble and units steps on several features, applied together as one stress variant; enables site (format, or pasteur-cli catalog) |
--site-draws |
— | Write this many random site draws (site_<i>) instead of the site as declared; each draw keeps each step with its chance |
--positive-group-id |
103 |
group_id for positive cohort (flipper). Repeat once per class/label for --task multiclass/multilabel |
--task |
binary |
binary, multiclass, multilabel, or regression: how flipper pairs are sampled |
--flip-threshold |
— | Regression only: clinical cutoff (target units) that flipper pairs straddle; omit to skip flipper |
--flipper-pairs |
200 |
Cross-label pairs to sample |
--flipper-steps |
20 |
Interpolation steps per pair |
--sweep |
— | Repeatable FEATURE[=CUTOFF], one 1-D sweep grid per feature (sweep/sweep.parquet); omit to skip sweep |
--sweep-range |
— | LO:HI of the grid, required with --sweep: absolute, or a multiplier of each feature's cutoff when --sweep-relative-to is set |
--sweep-relative-to |
— | CUTOFF: makes --sweep-range relative, and is the cutoff for --sweep features without their own |
--sweep-steps |
25 |
Grid points over --sweep-range, both ends included |
--sweep-near |
— | FRAC: adds --sweep-steps more points within ±FRAC of the cutoff |
--random-state |
42 |
RNG seed |
The --id-col, --feature, and --positive-group-id defaults come from the example thyroid dataset; always pass them for your own data. --jitter-scale is in units of the feature's standard deviation.
Output: output/<sim_type>/<variant>.parquet — see Output Layout.
Write a Hugging Face dataset card (README.md) for a simulation bundle.
hf datasets info org/source-dataset --format json > source-info.json
pasteur-cli card \
--input ./output \
--source-dataset org/source-dataset \
--dest-repo org/source-dataset-simulations \
--source-info source-info.json| Flag | Description |
|---|---|
--input |
Simulation bundle root (default: output) |
--source-dataset |
Source HF dataset id (provenance link) |
--dest-repo |
Destination repo id (README title) |
--source-info |
JSON from hf datasets info --format json |
--tag |
Repeatable; alternative to --source-info tags |
--description |
Alternative to JSON description field |
--output-readme |
Default: <input>/README.md |
Uploading is a separate, explicit hf upload step outside Pasteur. Only publish simulations of public or synthetic data; bundles made from patient data contain patient identifiers and must not be uploaded (see AGENTS.md).
Score one local ONNX model (or pre-computed predictions table) against a local simulation bundle.
pasteur-cli evaluate blackout \
--sim-root ./sim \
--labels ./labels/groups.parquet \
--model ./models/model.onnx \
--positive-group-id 103 \
--output ./scores.json| Flag | Default | Description |
|---|---|---|
sim_type |
(positional) | blackout, jitter, flipper, sweep, scramble, units, or site |
--sim-root |
(required) | Local bundle with clean/ and <sim_type>/ |
--labels |
(classifiers) | Local groups.parquet for label derivation. Required for every classifier, even with --oracle-labels; regression takes --targets instead |
--oracle-labels |
— | Per-row oracle labels parquet (variant_name, source_row_id, and label for binary or one group_<id> per --positive-group-id for multiclass/multilabel; schema). Classifiers only |
--abstain-class |
— | Output class that means "cannot decide" (multiclass/multilabel with --oracle-labels) |
--targets, --target-col |
(regression) | Local targets parquet and its target column |
--targets-id-col |
node_id |
ID column of --targets, matched as text |
--model |
(or --predictions) |
Local .onnx path |
--predictions |
(or --model) |
Pre-computed predictions parquet keyed by variant_name and source_row_id, one Float64 column per output ([NAME=]PATH) |
--contract |
— | Explicit metadata.json path (default: next to --model) |
--input-name |
input |
ONNX input tensor name |
--null-fill |
(see below) | What a null becomes on the way into the model |
--positive-class-index |
1 |
Binary only: positive class column in prob output |
--positive-group-id |
103 |
group_id for positive cohort; repeat once per model output (in output.classes order) for multiclass/multilabel |
--task |
binary |
Must match the model's metadata.json task_type |
--dataset-name |
simulation |
Internal dataset key in JSON |
--flip-threshold |
0.5 |
Decision threshold for flipper/sweep (multilabel: labels without a contract threshold; unused for multiclass). Regression: clinical cutoff in target units, no default, required for flipper |
-o, --output |
stdout | Write EvaluationResult JSON to file |
Score multiple local ONNX models and/or pre-computed prediction tables; optionally write predictions parquet.
pasteur-cli compare blackout \
--sim-root ./sim \
--labels ./labels/groups.parquet \
--model ./models/a.onnx \
--predictions rules=./predictions/rules.parquet \
--predictions-out ./predictions/blackout.parquet \
--output ./comparison.jsonSame flags as evaluate, except:
--modeland--predictionsare repeatable and can be mixed in one run (--predictions [LABEL=]PATH). Unlabelled inputs are named by file stem; every compared input must have a distinct label.--predictions-outwrites a local per-patient predictions parquet- A single
--contractapplies to every model (or provides class/label names and thresholds when only--predictionsare given)
Predictions schema: source_row_id, variant_name, label, one f64 column per model (stem of model path), all_agree (every model makes the same decision). Binary decisions are the side of a fixed 0.5. Multiclass and multilabel write label__<class> and <model>__<class> per class; their decisions are the argmax, or the set of labels at or over each threshold. Regression writes target instead of label, and all_agree compares sides of --flip-threshold (null without one).
The --output directory must already exist.
Print the perturbation toolkit as JSON: simulators, scramble encodings, unit presets with factor and offset, and the site-file format with a working example. No options, no data read. For scripts and agents that build a site file.
pasteur-cli catalogManage the local Pasteur staging cache ($PASTEUR_RS_CACHE_DIR, OS cache …/pasteur-rs, or ./.pasteur-rs-cache). Separate from the Hugging Face Hub cache (hf cache …).
pasteur-cli cache list
pasteur-cli cache list --cache-dir /tmp/my-cache
pasteur-cli cache rm stub.onnx --kind models
pasteur-cli cache rm run-a --kind auto
pasteur-cli cache clear
pasteur-cli cache clear --kind simulations| Subcommand | Description |
|---|---|
list |
Show cache root and entries under models/ and simulations/ |
rm <name> |
Delete one entry (--kind models|simulations|auto, default auto) |
clear |
Delete all entries (--kind optional; default both buckets) |
Defined in core/src/schema.rs:
EvaluationResult:baselines,evaluations.metric_invariant,evaluations.metric_based,created_at, plus optionalmulti(multiclass/multilabel),regression,oracle(when--oracle-labelsis passed), andsweep(forsweepevaluations) sections,parse_loss(stress-variant values that became null when cast to numbers), andstress(per stress variant or site draw: rows changed and decisions changed)ComparisonResult:evaluations: [{ model_label, evaluation }]
evaluate and compare derive the feature order from the simulation bundle's
own clean/ parquet — nothing in the ONNX graph says what those columns mean.
A wrong width errors inside ONNX Runtime; a wrong order at the right width does
not, and every patient silently gets scored against the wrong thresholds.
Pass --contract /path/to/metadata.json when the sidecar is not next to the
model (for example, when ONNX files and their metadata are stored in separate
directories). Otherwise {model_dir}/metadata.json is used when present:
{
"input": {
"feature_order": ["TSH", "T3", "T4"],
"absent_sentinel": 0.0
}
}| Flag / key | Effect |
|---|---|
--contract |
Explicit path to the contract JSON; overrides the default {model_dir}/metadata.json lookup |
input.feature_order |
Compared element-wise against the order derived from the data; a mismatch aborts the run and names the first differing index |
input.absent_sentinel |
Default for --null-fill — the value the model was fit with standing in for "absent" |
Both keys are optional and unknown keys are ignored, so an existing model
metadata file can carry them alongside its own fields. A model with no sidecar still loads; only its width
gets checked, and --null-fill falls back to NaN. A sidecar that exists but does
not parse is an error — a contract nobody can read looks like protection that
isn't there.
Why NaN and not 0.0: in a clinical feature space 0.0 TSH is not absence,
it is profoundly suppressed — a hyperthyroid signal — so filling zeros lets
blackout push patients toward the positive class. NaN-native models handle
missingness as missingness; anything exported from sklearn-onnx returns NaN
probabilities instead, which predict_proba rejects outright rather than letting
them poison ROC AUC. Pass --null-fill 0 (or declare absent_sentinel) for those.