Reading the results¶
evaluate and compare report a small set of numbers per model. This page
defines each one, says which direction is better, and lists the caveats that
matter when you use them to choose between models.
All metrics are computed on the rows in your simulation bundle, with labels
from --labels and --positive-group-id.
Metrics¶
Field |
Definition |
Reading it |
|---|---|---|
|
ROC AUC of the model on the clean cohort. |
Ordinary discrimination. Higher is better; 0.5 is chance. |
|
ROC AUC on the stress variant (blackout, scramble, or units) ÷ ROC AUC on the clean cohort. |
1.0 means the stress cost nothing. 0.9 means the model kept 90% of its AUC. Higher is better. |
|
|
1.0 means predictions did not move under noise. Lower means individual patients’ scores move when the measurement is noisy. Higher is better. |
|
For each sampled pair of opposite-label patients, the position |
Describes where the decision boundary sits between real patients. It is a description, not a score. Compare models against each other, not against a target value. |
|
The lowest resiliency over the site draws scored ( |
The model’s worst simulated site, not its average one. With site
draws, |
|
Of the rows a stress variant changed, the share whose decision differs from the model’s decision on the clean row. See Stress. |
0 means no patient’s answer moved. Lower is better. |
Caveats¶
One simulation type per run. evaluate blackout loads only
blackout/. Metrics for simulation types that were not loaded are reported
at their neutral value: resiliency and jitter_stability are 1.0,
and flipper_stability is null. Run once per simulation type and read
the matching metric from each run:
Run |
Metric to read |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ROC AUC needs both classes. If the clean cohort has no positive rows, or no negative rows, ROC AUC is reported as 0.5 rather than as an error. Check your label counts first.
Tied scores count half. ROC AUC counts a tied positive/negative pair as half a win, whatever order the rows are in. Before this release ties were broken by row order, which mattered for models that emit many identical scores (tree ensembles, models fed a constant blackout fill).
Non-integer IDs are labelled negative. A row is positive only when its ID
parses as an integer and appears in member_ids. Identifiers such as
A00123 are silently treated as negative. Map them to integers before you
run Pasteur.
Missing values reach the model as NaN. Unless the model declares an
absent_sentinel or you pass --null-fill, blacked-out values are sent
to the model as NaN. Most exported scikit-learn models cannot handle NaN and
Pasteur stops with an error instead of reporting bad numbers. The simplest fix
is to include the imputer in the exported pipeline; see
Walkthrough: choosing between models.
Unparseable text is silent missingness. Scoring casts features to numbers
non-strictly, so scrambled values such as 5,2, <5.2 or 5.2 mg/dL
become null without an error. They then take --null-fill or the model’s
absent_sentinel if set, and otherwise reach the model as NaN.
parse_loss counts them: the stress variant’s loss beyond what the clean
variant already loses in the same column. A scramble run with high parse loss
is close to a blackout run. Sentinels
such as -999 parse, to wrong values.
Stress¶
Resiliency is a ratio of two AUCs. It can stay near 1.0 while individual
patients change sides, because AUC only sees the ranking. The stress
section counts those patients. It has one entry per stress variant
(blackout, scramble, units, site, or each site draw) and needs no oracle
labels: the reference is the model’s own decision on the clean row.
silent_change_rate is the exception, because --abstain-class is
passed together with --oracle-labels.
Field |
Definition |
|---|---|
|
|
|
This variant’s ROC AUC against the clean rows’ labels, and its share of the clean ROC AUC. For multi-output models, the mean over labels. |
|
Rows scored, and rows where at least one feature reaches the model with a different value than in clean |
|
Changed rows whose decision differs from the decision on the clean row |
|
|
|
As |
A decision is p ≥ --flip-threshold for binary models, the argmax class
for multiclass, and the set of labels at or over threshold for multilabel.
“Changed” means changed for the model. Rows are compared after the same
lenient numeric cast scoring uses. 5.2e0 in place of 5.2 is not a
change. <0.01 in place of 0.008 is: it parses to nothing. An identity
control (a units step with factor 1) must report rows_changed: 0; if it
does not, distrust the run.
The same change is not always the same kind of error. A relabelled unit
or a different decimal mark keeps the patient’s meaning, so the right
behaviour is the same answer, and every changed decision is a failure. This
is a metamorphic test [Chen1998] [Segura2016], the invariance test of
[Ribeiro2020]; [Hendrycks2019] report the same quantity for image models as
flip probability. A blacked-out assay or an unlabelled unit destroys
meaning, so the right behaviour is to refuse. With --abstain-class,
silent_change_rate counts only the answers that changed without a
refusal, the reject option of [Chow1970] and [Geifman2017]. To score
decisions against what the answer should be, pass --oracle-labels and
read Oracle labels.
Classifiers only. A regression model has no decision without a cutoff;
its results carry no stress section.
Why the worst site. generalizability is a minimum because a mean over
sites hides the one a model fails at [Sagawa2020] [Koh2021]. It is still a
number about simulated sites: declared perturbations of one cohort, not other
hospitals’ patients. Validation on real external cohorts remains the
standard [Steyerberg2016] [Futoma2020].
Per-patient predictions¶
compare --predictions-out writes one row per patient per variant:
Column |
Meaning |
|---|---|
|
The patient’s original ID (synthetic path ID for flipper and sweep rows) |
|
|
|
1 if the patient is in the positive group, else 0 |
one column per model |
Positive-class probability. Named after the model file, without
|
|
True when every model puts the patient on the same side of 0.5
(fixed; |
For multiclass and multilabel models, label becomes one
label__<class> column per class, and each model gets one
<model>__<class> column per class. all_agree compares the argmax class
(multiclass) or the set of labels at or over each model’s thresholds
(multilabel). Compared models must list the same output.classes.
Use it to find the specific patients whose score moves, and to review them with clinicians.
Multiclass and multilabel models¶
For a model with K outputs, every metric is computed per class (multiclass)
or per label (multilabel). The headline fields above hold the macro
average over classes, so they read on the same scale as a binary model’s.
The extra multi section of the JSON holds what the averages hide. It is
absent for binary models.
Metric |
How it generalizes |
|---|---|
ROC AUC |
Each class against the rest (multiclass), or each label on its own
(multilabel). |
Resiliency |
Stress-variant AUC ÷ clean AUC for each label, then averaged. Labels whose
clean AUC is 0.5 or below are skipped: a ratio against chance-level
performance means nothing. |
Jitter stability |
Multilabel: |
Flipper stability |
Multiclass: pairs are drawn from two different classes a and b, and
the flip is where |
Read ``flipper_never_flipped`` next to ``flipper_stability``. Pairs that
never cross count as 1.0 in the mean, so a model that rarely changes its mind
along these paths scores high for that reason alone.
multi.flipper_never_flipped reports the share.
Regenerate the flipper grid when the task or groups change. Multiclass
grids store class indices in --positive-group-id order, and multilabel
grids store the label index in pair_label. Evaluating a grid built for a
different task is an error. Evaluating one built with the same task but
different groups is not detected.
Sweep¶
evaluate sweep adds a sweep list to the JSON, one entry per swept
feature. A path is one source row swept over one feature. The model’s
decision at each step is the positive class at or over --flip-threshold
(binary), the argmax class (multiclass), or the set of labels at or over their
thresholds (multilabel). A flip is a step where the decision differs from
the step before, and its flip value is the midpoint of the two bracketing
grid values. Sweep is scored for classifiers only.
The full metrics compare the model with an oracle: the correct decision
for every grid row, because moving a feature across its cutoff can change the
correct answer. Pass it with --oracle-labels (see Oracle labels),
covering the clean and sweep rows. Rates are shares of paths.
Field |
Definition |
|---|---|
|
Median, |
|
Paths where the model and the oracle each flip exactly once, to the same decision. Higher is better. |
|
Among paths where the oracle flips, the share where the model never does. Read it as “ignores this feature”. Lower is better. |
|
Paths where the model flips more than once. A model that reads digit patterns rather than magnitudes flips back and forth. Lower is better. |
|
Accuracy against the oracle over every grid row, and at each step
(with that step’s |
|
Median and quartiles of the model’s flip value, in feature units, over paths where it flips exactly once. |
Without oracle labels the output is descriptive. Without
--oracle-labels, oracle is false and only model_flip_value,
extra_flips_rate and never_flipped are filled. never_flipped then
counts every path whose decision never changes, so both ends of the grid get
the same answer. A model may be right not to flip: read it against a range
that you know crosses the cutoff. boundary_offset, monotonic_rate and
the accuracies are null.
The grid limits the resolution. Flip values are grid midpoints, so an
offset is exact only to within one grid step. Use --sweep-near to add
points close to the cutoff.
Regression models¶
A single-target regression model (--task regression) predicts a value in
the target’s units instead of a probability. The JSON keeps the same shape,
with these fields:
Field |
Definition |
|---|---|
|
Root-mean-square error, mean absolute error, and R² on the clean cohort. RMSE and MAE are in the target’s units; lower is better. R² is 1 for a perfect model, 0 for one no better than predicting the mean, and negative for one worse than that. |
|
Stressed R² ÷ clean R², where the stress variant is blackout, scramble
or units: the share of the model’s skill over predicting the cohort
mean that survives it. 1.0 means the stress cost nothing; 0 means the
model fell back to no better than the mean; negative means it made the
model worse than the mean. It can exceed 1.0 when the stress happens
to help, which usually means the perturbed feature was hurting the
model. A model whose clean R² is
0 or below has no skill to keep and is reported at the neutral 1.0;
read |
|
|
|
For each pair of one patient whose true target is below the
|
Why an R² ratio and not an RMSE ratio. An error ratio rewards a model
for having little accuracy to lose. When a model loses a feature entirely and
falls back to the mean, clean RMSE ÷ blackout RMSE is sqrt(1 − R²): about
0.58 for a model with R² 0.66, but 0.86 for one with R² 0.26. On a synthetic
HbA1c cohort with glucose blacked out for every patient, a 1-nearest-neighbour
model dropped from R² 0.26 to −0.09 (worse than predicting the mean) and still
had the best RMSE ratio, 0.82, of the models that used glucose. Its R² ratio
is −0.35, the worst.
The regression section reports the same behaviour in the target’s units:
target_sd, blackout_rmse, blackout_r2, jitter_prediction_sd (the mean
per-patient standard deviation of the prediction across jitter draws),
flip_threshold, and flipper_never_flipped. It is absent for
classifiers. blackout_rmse and blackout_r2 keep their names for
compatibility but hold whichever stress variant was loaded (blackout,
scramble, or units), as does metric_based.r2.resiliency.
The flipper cutoff is a clinical choice. There is no decision boundary in
a regression model, so flipper needs one: the threshold your service acts on,
such as HbA1c 6.5%. Pass the same --flip-threshold to simulate and to
evaluate. A grid evaluated against a cutoff that some pair does not
straddle is rejected. Without a cutoff, simulate skips flipper.
Read ``flipper_never_flipped`` here too. Pairs are chosen by their true targets, but crossings are read from predictions. A model whose predictions stay on one side of the cutoff for patients just above it never crosses, and those pairs count as 1.0. Regression models shrink towards the mean, so when the cutoff sits in the tail of the target this is common: on a synthetic cohort with 8% of HbA1c values at or above 6.5%, 57–68% of pairs never crossed for well-fitted models, and those pairs dominate the mean.
Jitter depends on the cohort. Because jitter is scaled by the target’s variance in the clean cohort, compare jitter stability between models on the same cohort only.
Oracle labels¶
Every metric above assumes a perturbation keeps the patient’s label: a jittered or blacked-out row is scored against the clean row’s label. For a decision model (a rule pack, an encoder or an LLM answering “eligible / not eligible / cannot determine”) that is often wrong. Moving a lab value across a criterion’s threshold should change the answer, and removing it may make the right answer “cannot determine”.
--oracle-labels supplies the correct label for every simulated row,
computed by your own oracle (for example the rule engine or generator that
made the case). The file is a parquet with one row per simulated row:
Column |
Meaning |
|---|---|
|
|
|
The row’s ID; |
|
Binary: 1 or 0 |
|
Multiclass and multilabel, one per |
It replaces the labels of every variant, clean included, so it must cover
every row of the clean data and of the simulation type being evaluated. A
missing row is an error. Other columns are ignored, and so are rows for
variants not loaded, so one file can serve every simulation type. Regression
is not supported.
The labels --predictions-out writes then come from the oracle too.
With oracle labels the JSON gains an oracle section. All of it compares
decisions, not probabilities: p ≥ --flip-threshold for binary, the
argmax for multiclass, and the set of labels at or over threshold for
multilabel.
Field |
Definition and reading |
|---|---|
|
Share of rows whose decision equals the oracle label, per variant
( |
|
Over every (row, jitter draw) where the oracle label is the same as on the clean row: the share where the model’s decision changed anyway. Lower is better; this is instability the truth does not justify. |
|
Over every (row, jitter draw) where the oracle label changed: the share where the model’s decision changed to the new label. Higher is better; it is the model following the truth. |
|
The denominators. A rate is |
|
For each pair, |
|
Share of pairs whose oracle label never changes along the path. Those pairs have no true boundary to compare against. |
|
With |
Where the oracle flips. Oracle labels are 0/1, so oracle_flip_t lands
halfway between the last grid step before the change and the first one
after. With --flipper-steps 20 that is within 1/38 of the true crossing;
add steps when the boundary error you care about is smaller than that.
The model’s flip_t is interpolated from its probabilities as for
flipper_stability. Multiclass uses the same p[b] − p[a] rule for both,
so an oracle label of a third class counts as the b side.
Pairs where only one side flips. A pair where the model flips but the
oracle does not, or the reverse, is left out of boundary_error. Read
oracle_never_flipped and n_pairs_compared beside it.
Jitter rates pool draws. Each (row, draw) counts once, against the clean row. A row that flips in two draws counts twice.
The abstain class is matched by name against the model’s
output.classes, and must be one of them. It applies to multiclass and
multilabel models; a binary model has no class to abstain with.
What these numbers do not show¶
They describe behaviour under the perturbations you declared: one feature removed at one rate, noise at one scale, straight-line paths between real patients. They do not measure calibration, fairness across subgroups, performance on another site’s population, or clinical benefit.