The question
In 1936, R. A. Fisher published a linear discriminant fitted on a hundred iris flowers and showed that a single straight-line combination of four measurements could separate two overlapping species. Ninety years of classification research followed — logistic regression, nearest-neighbour rules, kernel machines, gradient-boosted trees — each capable, in principle, of finding curvature a straight line cannot. This study puts the question as a decision an ordinary practitioner could act on:
On the exact species pair Fisher studied, does any post-1936 classifier separate versicolor from virginica measurably better than his own 1936 discriminant, on flowers neither method has seen? And is the separating signal really in all four measurements, or do the two petal measurements alone carry essentially all of it?
This is a deliberate, independent redo. An earlier study in this repository looked at
the same pair of species; this one is typed, gated and run without opening a single file
from it, so that whatever it finds is arrived at on its own evidence, not copied or
avoided (scouting_ledger.md; research_plan.md's “Out of
scope, deliberately”). Comparing the two studies is left to the reader.
The contract, registered before any evidence existed
A predict study, modality tabular, profile
generic, over the four measurement columns of 99 iris flowers
(sklearn:load_iris, restricted to versicolor and virginica). Three tracks,
not one, because the headline question is a comparison and a track gets exactly
one sealed access: a single-track study could confirm the incumbent's level but
never the gap.
fisher(registered,estimate) measures the incumbent's own level, with a bootstrap interval.modern(frontier,predict) holds Fisher's discriminant as the incumbent; the four post-1936 challengers — L2 logistic regression, 5-nearest-neighbours, an RBF-kernel support-vector machine, a histogram gradient-boosted tree — climb it one at a time.ablation(registered,test) maps which measurements carry the signal: petal-only against sepal-only against all four.
Every track shares one primary metric, ROC-AUC (val_auc, higher is
better) — chosen before any byte was read because it is threshold-free and resolves
finer than accuracy on a 25-flower block. Sixteen predictions, P0 through P15, were
registered with arithmetic rules before the first row was fitted, and every headline
number in the sections that follow is a copy of a value pinned in
claims.lock, results.tsv or aux_metrics.tsv.
Three things to take away, and none of them is “LDA still wins”
- The primary metric saturated. Fisher's own discriminant scores a
perfect ROC-AUC of
1.000000on the development block and again on the sealed block. Every noise-floor recipe Phase 0 ran on thefisherandmoderntracks came back with a spread of exactly zero, so the measured keep bar on both tracks is0— not left unmeasured, measured to be zero. - A zero floor turns a tie into a keep. With the bar at zero, the
frontier rule
primary_metric >= incumbent + minimum_deltais satisfied by an exact tie. Four of the fivemodern-track development cells filed askeep; zero of the four challengers resolvably beat Fisher's discriminant by any amount the contract could certify. In the one sealed comparison the study did make, the selected challenger lost. - The ablation asked a different question, and it is answerable. The two petal measurements alone reproduce the all-four score exactly, on both the development and the sealed partition. The two sepal measurements alone lose a real, large amount of separation — and still miss a pre-registered bar built from that same effect's own spread. Both halves of that surprise are load-bearing for what this tutorial teaches in section 4.
The rest of this page teaches the method (section 2), the data and the one leakage bug an independent audit found and fixed before any model ran (section 3), the four-phase experiment ladder that produced the saturation above (section 4), the verdicts and surprises this study is willing to stand behind (section 5), an annotated walkthrough of the code that produced every number on this page (section 6), and what a next study should do differently (section 7).
The method taught
The shadow-casting angle
Picture the flowers as points floating in a four-dimensional room, one axis per measurement, coloured by species. The two colours form overlapping clouds. Now shine a light through the room and read the shadow the points cast on a wall — a one-dimensional line. Most directions give a useless shadow where the colours smear together, but some direction gives the cleanest separation, and that direction is the whole of linear discriminant analysis. Once you have it, classification is trivial: project a flower onto that line and see which side of a threshold it lands on.
“Cleanest” is not simply the direction where the two cloud centres land furthest apart — a direction can spread the centres and spread each cloud equally, gaining nothing. What you want is the gap between the centres relative to how fat the clouds are along that same direction. Three equivalent ways to say the same thing: LDA is a two-sample -statistic maximised over every possible linear combination of the measurements; LDA is PCA that has been told the labels, finding the direction of largest between-species spread per unit of within-species spread rather than largest total spread; LDA is “whiten, then point at the difference” — rescale the room so the within-species scatter becomes a sphere, and in that reshaped room the best direction is simply the line joining the two cloud centres.
The math core
Let be a flower's measurements and its species. With class means and mean difference , the within-class scatter and between-class scatter give Fisher's criterion — the squared gap between projected means divided by the pooled variance of the projection:
fixes a direction, never a scale: any two implementations must agree by angle, not by raw coefficient magnitude. Because has rank one, the maximiser of collapses to one line — no iteration, no learning rate, one matrix solve:
This is the whole fitting procedure — which is why lda_all4 carries
no random_state at all in this study's recipe table, and why its fit noise is
exactly zero by construction. It is also not merely a reasonable rule; under two
Gaussian classes sharing one covariance , the
log posterior odds is exactly linear in with this same
:
so LDA is the plug-in Bayes rule — the mathematically best possible classifier in that world, with population moments replaced by sample estimates. Iris versicolor and virginica are close to that world: four smooth, roughly bell-shaped measurements, two species whose scatter is similar in shape. If the assumption holds even approximately, a more flexible learner has nothing left to find; it can only add variance. That is the method card's central bet, and section 4 shows what happened when it was tested.
The ruler, not just the model: what ROC-AUC can and cannot resolve
ROC-AUC is the probability that a randomly chosen virginica scores above a randomly chosen versicolor — the Mann–Whitney statistic over every positive–negative pair. The development block holds 13 versicolor and 12 virginica, so the statistic is a count over 156 ordered pairs and can only move in steps of :
That is the instrument's resolution — the smallest non-zero difference it can express. It is not the same thing as its noise floor: resample the same 25 rows, or redraw which 25 they are, and the statistic wanders by a different, usually much larger amount. This study's own convention is a paired bootstrap: draw one shared resample index and apply it to both the candidate and the reference score in lock-step (common random numbers by construction), so the errors that are common to both cancel and only the genuine difference remains. The resulting bar is over the replicates — a floor that is measured, at Phase 0, before a single challenger runs. Confusing the 0.0064 resolution with this measured floor is exactly the mistake this study's own doctrine refuses to make.
Practice: fourteen lines of numpy, checked against scikit-learn
The whole fitting procedure, with no framework:
mus = np.stack([X[y == c].mean(axis=0) for c in classes]) # class means
priors = np.array([(y == c).mean() for c in classes]) # empirical priors
S_W = np.zeros((p, p)) # within-class scatter
for k, c in enumerate(classes):
Z = X[y == c] - mus[k]
S_W += Z.T @ Z
Sigma = S_W / (n - K) # pooled covariance, unbiased
d = mus[1] - mus[0]
w = np.linalg.solve(Sigma, d) # Sigma^-1 (mu1 - mu0)
b = -0.5 * (mus[1] @ np.linalg.solve(Sigma, mus[1])
- mus[0] @ np.linalg.solve(Sigma, mus[0])) + np.log(priors[1] / priors[0])
score = X @ w + b # > 0 -> predict virginica
Run at the METHOD gate against LinearDiscriminantAnalysis(solver="svd") on
this study's own 49 training rows, before any evidence was spent: cosine similarity of the
two discriminant directions 1.000000000000000, maximum absolute coefficient
difference 7.105e-15, maximum decision-score difference over the 49 rows
1.776e-14. Two implementation details cost that agreement if skipped:
np.linalg.solve rather than an explicit matrix inverse, and the
prior term in the intercept, which on
this study's 25-versus-24 training split is
— small enough to hide, large enough to move a borderline flower's predicted label
even though it never touches the fitted direction.
The four post-1936 challengers, in one sentence each
| Recipe | First published | Intuition |
|---|---|---|
logreg_l2 | Berkson 1944 / Cox 1958 | The same flat boundary, chosen by a different question — not “which direction separates the clouds” but “which boundary makes the observed labels most likely” — with an L2 penalty shrinking the coefficients toward zero. |
knn5 | Fix & Hodges 1951 / Cover & Hart 1967 | No model at all: classify a flower by a majority vote of its five nearest training flowers. Infinitely flexible in principle; with 49 training flowers, a coarse instrument in practice. |
svm_rbf | Boser–Guyon–Vapnik 1992 / Cortes & Vapnik 1995 | Lay the widest possible road between the two classes, after bending space with a Gaussian kernel so the road may curve. |
hgbt | Friedman 2001 / Ke et al. 2017 | A committee of short, axis-aligned staircases, each fitted to what the committee so far still gets wrong. |
Two of these (logreg_l2, and svm_rbf with a narrow enough
kernel) can reproduce something close to Fisher's straight boundary. Two of them
(knn5, hgbt) cannot draw a smooth oblique line at all — if
the true boundary really is close to a plane, that is a handicap, not a feature: variance
spent buying flexibility the boundary does not need. Section 4 measures which of
these two pictures the data actually supports.
The data story
The source is sklearn.datasets.load_iris, restricted to the two species
that overlap — setosa is trivially separable and is out of scope by design. The raw
loader hands back exactly 100 flowers, 50 of each species, 4 measurement columns; that
identity is asserted on the RAW load, not the prepared table, so a lawful data-gate row
drop can never manufacture a false refutation of it (prediction P0). Every column is a
genuine float64 centimetre measurement — sepal length, sepal width,
petal length, petal width, ranges 4.9–7.9, 2.0–3.8,
3.0–6.9, 1.0–2.5 — and the target is a genuine
integer 0/1, not a disguised string boolean. That is a rare, cleanly-typed result, and it
was still checked in full by printing every column's sorted value set rather than trusted
because the table “looked clean”: the mandatory value-pattern check exists
precisely because dtype == "object" has silently hidden a categorical column
before in this framework's own history.
The blocker an independent audit found and fixed
The mechanized four-row leakage audit (python -m kleinlib.leakage) failed
its duplicate-row check on the unmodified 100-row table:
[FAIL] duplicate-rows: 1 duplicated row-content hash(es) straddle partitions (train/development=1, train/test=0, development/test=0)
The hard pair contains one exact-duplicate row: two virginica flowers, identical on
all four measurements at (5.8, 2.7, 5.1, 1.9). Under the declared stratified
split, seed 20260904, the two copies land on opposite sides of the
train/development boundary — one in training, one in development. That is exactly
the leakage mechanism the data-gate protocol names: a memorization-capable challenger
(knn5 most directly) can score the development copy correctly for free off a
byte-identical training twin, in precisely the paired comparisons this study's predictions
are decided on.
The fix was made entirely inside prepare.py, with no edit to
study.yaml: drop the duplicate's second copy, deterministically, before the
table is written. A true duplicate carries zero information beyond its twin, so the fix
costs nothing. prepare.py was re-run, the table re-profiled, the split
re-drawn, and the audit re-run clean:
[OK] split-reproduces: kind=stratified reproduces deterministically from study.yaml (train=49 development=25 test=25 rows)
[OK] duplicate-rows: no duplicate row content straddles partitions
[OK] group-overlap: N/A — split kind is not 'group'
12/12 checks passed: clean
The realized table is 99 rows, not the round 100 several contract
documents describe in prose — a direct, deterministic consequence of dropping one
duplicate. The split realizes 49 training / 25 development / 25 sealed
flowers (development and test both land exactly on the intended 25, preserving the
exchangeability the study's paired floors depend on), per-class counts train
{versicolor 25, virginica 24}, development {versicolor 13, virginica 12}, test
{versicolor 12, virginica 13}. Class balance shifted from an exact 50/50 to 50 versicolor
/ 49 virginica — a positive rate of 49.49% — because the dropped
duplicate was virginica; negligible at this scale, and no registered prediction's
arithmetic depends on the literal row count.
Two questions this study needed answered before trusting a single number
Does this copy of the table differ from Fisher's own? The UCI mirror
of iris is documented to contain transcription errors relative to the original. An
independent fetch and cell-by-cell diff against sklearn's bundled copy found
exactly three cell differences across two rows — both setosa. Zero
differences anywhere in the 100 versicolor/virginica rows this study actually models: the
hard pair is byte-identical between the two sources.
Does the negative control fire correctly? A constant predictor and a
label-shuffled predictor both score at chance on all three tracks
(constant-chance val_auc=0.5000; shuffled-chance
between 0.4391 and 0.5192), inside the tool's default margin. A
pipeline that could not score chance at chance could not be trusted with a perfect score
either.
Go / no-go
GO. One blocker was found, by a mechanized and unconditional check,
and fixed with a one-row, zero-information deletion that touched no line of
study.yaml. Every remaining item is a WARN or NOTE: the small-n
design is already the subject of this study's own bootstrap and headroom machinery; the
realized 49-row training partition is a documented, arithmetically inert deviation from
the contract's round-number prose; the UCI discrepancy touches nothing in the rows this
study models. This card's ruling was reached without opening a single file from the
earlier study that examined the same species pair.
The experiment journey
Twelve notarized runs, four phases, three sealed accesses. The full ledger, as the notary recorded it — every run's track, disposition and printed primary metric:
Tracks: fisher — val_auc (higher is better) · modern — val_auc (higher is better) · ablation — val_auc (higher is better)
| Exp | Track | Kind | Metric | Status | Description |
|---|---|---|---|---|---|
| E0001 | fisher | development | 1 | measured | E0001 anchor: Fisher 1936 LDA, four features, fit on 49 training rows; registered cell measured |
| E0002 | modern | development | 1 | keep | E0002 seeds modern frontier: Fisher 1936 LDA (same recipe as E0001); first valid result on this track |
| E0003 | modern | development | 1 | keep | E0003: L2-regularized logistic regression vs Fisher's LDA refit on the same 25 development rows; frontier improvement over 1 with minimum_delta=0 |
| E0004 | modern | development | 0.990385 | discard | E0004: 5-nearest-neighbours vs Fisher's LDA refit on the same 25 development rows; did not improve track frontier 1 by minimum_delta=0 |
| E0005 | modern | development | 1 | keep | E0005: RBF-kernel SVM vs Fisher's LDA refit on the same 25 development rows; frontier improvement over 1 with minimum_delta=0 |
| E0006 | modern | development | 1 | keep | E0006: histogram gradient-boosted tree vs Fisher's LDA refit on the same 25 development rows; frontier improvement over 1 with minimum_delta=0 |
| E0007 | ablation | development | 1 | measured | E0007 ablation: petal-only LDA vs all-four LDA (RQ2); registered cell measured |
| E0008 | ablation | development | 0.814103 | measured | E0008 ablation: sepal-only LDA vs all-four LDA (RQ2 sanity check); registered cell measured |
| E0009 | ablation | development | 1 | measured | E0009 ablation: petal-only hgbt vs all-four hgbt (RQ2 repeated with the parade's best-scoring modern family); registered cell measured |
| E0010 | fisher | final_test | 1 | measured | sealed: Fisher 1936 LDA level on the 25 sealed test rows; registered cell measured |
| E0011 | modern | final_test | 0.987179 | discard | sealed: hgbt (selected) vs lda_all4, paired, same sealed rows; sealed final-test evidence; excluded from the adaptive frontier |
| E0012 | ablation | final_test | 0.987179 | measured | sealed: petal-only + sepal-only vs all-four LDA, same sealed rows; registered cell measured |
Read it with the floor in hand, one phase at a time.
Phase 1 — anchor and floor: know the instrument before comparing anything
E0001 is the identity anchor and the incumbent's level, in one cell.
On the raw loader: 100 rows, 50 of each species, 4 features, and the three partitions sum
back to the prepared total — P0 supported on all five clauses. Fisher's
lda_all4, fit on the 49 training flowers and scored on the 25 development
flowers: val_accuracy=0.96, val_errors=1,
primary_metric(val_auc)=1.000000. P1 ()
and P2 ( errors) both supported, comfortably. The
2000-replicate bootstrap interval for that AUC came back ci_low=1.000000,
ci_high=1.000000, ci_width=0.0 — and P3, which predicted
an interval wider than 0.05, was refuted. The reason is arithmetic,
not a bug: hand-inspection of the score dump showed all 13 development versicolor flowers
scoring below 0.02 and all 12 virginica above 0.45, a clean rank
gap. Resample 25 already-cleanly-separated rows with replacement and every resample is
cleanly separated too — the percentile bootstrap has no variability left to report.
That is the first sign of the pegging this whole study turns on.
Four registered Phase 0 sweeps then measured every floor this study would use, before any challenger ran:
sweep:fit_noise_svm_rbf/sweep:fit_noise_hgbt(seed-sweep, five seeds, same 49/25 split): both recipes reach AUC1.0on every seed — provenance about the fit, never a bar.sweep:floor_modern(paired-bootstrap, 1000 replicates, pair(lda_all4, hgbt), fixed instudy.yamlbefore the measurement): the AUC difference is exactly0on every one of the 1000 resamples — std0, range0.sweep:floor_fisher(split-lottery, five redraws strictly inside the 74 non-sealed rows):lda_all4's own development AUC is1.0on every redraw — std0, range0.sweep:floor_ablation(paired-bootstrap, 1000 replicates, pair(lda_all4, lda_sepal)): a real, resolvable spread — mean-0.190092, std0.0952175, range0.5625, so .
Two of three tracks measured a keep bar of exactly 0. That is a
measured zero, pasted into study.yaml and re-recorded at the consult
gate, not an unmeasured placeholder. Klein's headroom law returns no number at all,
h = None, whenever minimum_delta <= 0 — not
“infinite headroom”, undefined headroom — which meant seven of
this study's sixteen predictions (P4–P8, P10, P11) could never print the
floor-normalized key their own registered rule needed. Each one's own
inconclusive_if clause, written before Phase 0 measured anything, already
named this exact condition. What it did not anticipate was that the floor would be
measured at zero rather than simply left unmeasured. This was flagged as an
explicit phase-boundary decision rather than resolved quietly: the orchestrator relayed the
user's decision to run the parade anyway, with the structural inconclusiveness accepted as
the honest, pre-registered outcome — not re-litigated, contract unedited.
Phase 2 — the parade: does ninety years of research beat him?
E0002 seeds the modern frontier with Fisher's own
lda_all4, refit on the identical split: primary_metric=1.000000,
matching E0001 to the printed digit — the two tracks are reading the same rows.
Then four challengers, each refitting lda_all4 as its reference inside the
same run, on the same development rows, so every comparison is paired by
construction:
- E0003 — L2 logistic regression:
val_auc=1.000000,delta_vs_reference=0.0. An exact tie. - E0004 — 5-nearest-neighbours:
val_auc=0.990385,delta_vs_reference=-0.009615. The parade's one genuine loss, and it is exactly the mechanism P6 predicted: with only 25 development rows,knn5can only ever print six distinct scores (proba_unique_values=6), and every tie costs ranking resolution. - E0005 — RBF-kernel SVM:
val_auc=1.000000,delta_vs_reference=0.0. Another exact tie, reproducing the Phase-0 seed-sweep's own finding. - E0006 — the boosted tree: printed
val_auc=1.000000,delta_vs_reference=-0.0; the raw stored value is0.9999999999999999, a floating-point hair below the reference, indistinguishable from a tie at print precision.val_accuracy=1.0,val_errors=0— the one number in this cell that is not tied.
The disposition quirk: how a tie becomes a keep
With minimum_delta measured at 0, the frontier rule
degenerates to — a
condition an exact tie satisfies. Four of the five modern-track development
cells (E0002, E0003, E0005, E0006) filed as keep; only E0004 discarded. Read
the ledger above by status alone and it looks like three of four post-1936
methods improved on Fisher. None of them resolvably did:
delta_vs_reference is 0.0 or -0.0 on every single
keep. This is the exact mechanism the study's own stop-rule check confirms did
not fire — only one discard occurred in the whole parade, never four
consecutive, so klein stop ack was never needed — but it is also the
reason prediction P9 (“zero of the four families earns a keep”) reads
refuted on the letter of its own arithmetic (the count is four, not zero)
while its substance — no post-1936 method separated the species measurably
better — is supported.
Phase 3 — the ablation map: which measurements carry it
The ablation track's floor is not degenerate — 0.28125,
measured from real resampling spread — so every prediction here resolves by ordinary
registered arithmetic, the first phase where nothing reads inconclusive.
- E0007 — petal-only LDA against the all-four reference, refit
paired in the same cell:
val_auc=1.000000,delta_vs_reference=0.0,delta_in_floors=0.0. P12 supported, the tightest possible margin: petal length and petal width alone land exactly on the all-four score. - E0008 — sepal-only LDA, same construction:
val_auc=0.814103,delta_vs_reference=-0.185897,delta_in_floors=-0.661. P13 refuted — but read that refutation carefully. An 18.6-point AUC loss is real, large and correctly directed; it simply does not clear the pre-registered bar of a full floor below, because the ablation floor itself (0.28125) was measured from this exact contrast's own paired-bootstrap spread — nearly a third of the whole 0-to-1 AUC scale. A registered floor-normalized rule and a raw effect size can tell different stories on the same run. - E0009 repeats E0007's comparison with the boosted tree in place of
LDA — the parade's incumbent, chosen because the parade itself left no
substantive ranking to pick a “best” family from (every keep tied), so
hgbtis both the track's current incumbent and the family least like LDA, the hardest available test of the claim:delta_in_floors=0.0. P14 supported — the petal verdict is a property of the flowers, not an artifact of the discriminant.
The bottom panel of that figure is the whole study in one picture: on fisher
and modern the shaded “cannot resolve” band has zero width, so
even hgbt's later sealed loss sits just outside a band too thin to see. On
ablation the band is wide enough that sepal-only's very real shortfall still
falls inside it.
Phase 4 — confirmation: three sealed numbers, spent once each
Every sealed cell was rehearsed first with klein run-one --final-test --dry-run
— three rehearsals, each printing sealed_dryrun: 1 on development data
and spending nothing.
E0010, the fisher track's sealed access:
lda_all4 refit on the 74 train-plus-development rows, scored on the 25 sealed
flowers nobody had looked at: val_auc=1.000000 again — the same peg,
reproduced on a different 25-row block, so it is a property of this species pair under
these four measurements, not one lucky development draw. But
val_errors rose from 1 to 2 at the ordinary
threshold of 0.5, and val_accuracy fell from 0.96
to 0.92: the rank statistic transferred exactly, the raw error count did
not.
E0011, the modern track's sealed access: the selected
challenger, hgbt, refit on the 74 rows and scored against
lda_all4 refit on the same sealed rows in the same run:
val_auc=0.987179 against a reference of 1.0 —
delta_vs_reference=-0.012821, exactly two of the block's 156 ordered pairs.
val_accuracy=0.88, three flowers misclassified against Fisher's two on the
identical rows. Predictions P10 and P11 both read inconclusive —
the floor-normalized keys they need are still unprintable at minimum_delta=0
— but this is the single most informative raw number the whole modern
track produced: every development-side comparison in the parade printed a tie, and on
rows neither model had ever seen, the ninety-years-later challenger lost.
E0012, the ablation track's sealed access: all three
feature sets refit on the 74 rows, scored on the same 25 sealed flowers in the same run.
Petal-only: val_auc=0.987179, delta_in_floors=-0.0456 —
comfortably inside the floor, confirming P12's development-side verdict on rows nobody had
adaptively touched. Sepal-only: sepal_delta_in_floors=-0.8547 — a real,
large, correctly-directed shortfall, wider than on development, that again falls just
short of the registered floor bar. P15
refuted on that second clause, for the identical structural reason E0008 gave.
Finally, klein replicate re-executed the development run behind every
confirmed claim in a detached worktree: E0001, E0006, E0007 and E0008 all reproduced
exactly, difference 0.0. (A sealed run cannot itself be replicated —
re-running it would be a second look at the sealed partition — so the replicate leg
is filed against the development run each sealed cell's config and comparison rest on.
E0001's first replication attempt timed out at the default budget with no output at all,
a cold-worktree startup cost, not a failed reproduction; the retry, given a longer budget,
reproduced exactly, and both attempts stayed on the record.)
Findings & insights
Twelve notarized runs across three tracks asked whether ninety years of classification
research separates versicolor from virginica better than Fisher's own
1936 discriminant. None of the four post-1936 challengers cleared the incumbent by any
resolvable amount: on the development block three of them tied it exactly at
1.000000 and the fourth lost; in the one sealed access the selected challenger
lost -0.012821 val_auc. But the study's most useful output is a failure of its
own instrument — the primary metric pegged at its own ideal, and
that single fact reshaped everything downstream of it.
Why the metric pegged, and why every instrument built on it inherited the saturation
ROC-AUC was chosen for resolution: on 25 development flowers accuracy moves in steps of
0.04, one whole flower, while AUC over 156 ordered pairs resolves to
0.0064. That reasoning is sound and still is — it simply missed that a
finer ruler is worthless against a quantity that has already reached its bound. On this
partition the 25 development flowers are perfectly rank-separated: every
versicolor scores below 0.02, every virginica above 0.45. Once a
sample is cleanly rank-separated, every resample of it with replacement is cleanly
rank-separated too — that is arithmetic, not a coding artifact — so the
percentile bootstrap returns ci_width=0, the paired bootstrap returns a delta
of exactly 0 on all 1000 replicates, and the split lottery returns
0 spread over five redraws. minimum_delta measures to
0; every floor-normalized key stops printing; the headroom law returns no
number at all. The sealed block reproduces the same peg (val_auc=1.000000
again, on 25 flowers nobody had looked at), so this is a property of the species pair
under these four measurements at this sample size, not one lucky development draw.
4 printed keeps, 0 resolvable wins
With minimum_delta measured at zero, the frontier rule
is satisfied by
an exact tie, and four of five modern-track development cells filed as
keep. A ledger reader who counted keep rows without reading
delta_vs_reference would conclude that three of four post-1936 methods
improved on Fisher. None did — delta_vs_reference is 0.0
or -0.0 on every single one. This is why prediction P9 (“zero of the
four families earns a keep”) is recorded refuted on the letter of
its own count while the science it was written to test — ninety years of research
producing no measurable separation gain — is supported.
The fourth surprise: a calibration reversal
On development, the boosted tree was not merely tied on ranking — it was the
parade's best-calibrated model by a wide margin, Brier 0.000945 and log-loss
0.012827 against Fisher's LDA at 0.017482 and
0.061537. On the sealed rows the same recipe collapses to Brier
0.118994 and log-loss 0.750798 — two orders of magnitude
worse than its own development calibration, while its ranking only slipped by
-0.012821 val_auc. The sealed LDA-family cell that scored the same rows (the
petal-only comparison) sits at Brier 0.057828 and log-loss
0.164260 — a far milder shift.
Read this as the textbook signature of a high-capacity learner memorizing 74 rows: the boosted tree's confidence was fitted to the training partition even where its ordering generalized. This is a mechanism interpretation, not a registered claim — the study's next-steps section names the direct repair.
The classification report, for the incumbent every other cell was measured against
Fisher's own lda_all4 is the reference every parade and ablation cell
refits inside the same run. Its score-separation on the development block is visibly
absolute:
The ablation's own honest wrinkle
Sepal length and sepal width alone lose a real, large, correctly-directed amount of
separation — -0.185897 val_auc on development, a wider
-0.8547 measured floors on the sealed block — and still fail the
pre-registered “at least one floor below” bar, twice, because the ablation
track's own floor (0.28125) was measured from this exact contrast's own
paired-bootstrap spread. A one-floor rule then demands roughly one and a half times the
effect's own mean magnitude. “Refuted” here means the registered bar was not
cleared, never that no difference was found — and both numbers belong in any honest
account of this result.
What the lock says
- claims
15locked inclaims.lock- by strength
- confirmed
6· exploratory9 - by class
- empirical-description
6· mechanism-interpretation3· procedural-verdict1· research-discipline5 - errata
0of15claims tagged ·0erratum record(s) in the lock- locked at
753eeac11d47· klein2.0.0- label
- confirmed
- referee
- PASS-WITH-NOTES —
klein-referee (Claude Code subagent, model: Claude Opus 5 / claude-opus-5[1m])· independent of the experimenter: yes
The claims that reach confirmed strength each cite both their sealed
evidence and a replication record, per this study's
confirmation.require: [sealed, replicate] — the two levels this study
pinned (C3), the two ablation halves on both partitions (C4, C5), the one sealed gap
(C6), and the agreement-and-disagreement between the two 25-row blocks (C7). The
procedural verdict on the parade's own keep count (C2) is confirmed by direct count on the
ledger itself. Everything else in the lock stays exploratory by design:
the development-only parade description (C1); the three mechanism interpretations —
the pegging (C8), the tie-as-keep arithmetic (C9), and the floor-from-effect wrinkle (C10)
— because a mechanism is confirmed by a later study that tests it, not by this one
asserting it; and the research-discipline lessons (C11–C15), which are advice for
the next study, not measurements of this one. Of the sixteen registered predictions,
5 supported, 4 refuted, 7 inconclusive, 0 open — and the seven
inconclusive rows are not an accounting gap. Each one's own inconclusive_if
clause, written before any run existed, names the exact condition that came to pass: the
floor was measured, honestly, and it came back zero.
Method coding advice
This is the actual, current mutable surface of the study — the bytes that
produced E0006, the run whose configuration is still live in train.py as the
modern track's incumbent (a non-selected candidate restores the surface after
a run, but E0006 was selected, so nothing was restored away from it). No verifier
is declared anywhere in this study: it is kind: predict, not
optimize, and nothing is checkpoint-scored, so there is no checker to freeze
— the fixed, unedited library code below plays that stabilizing role instead, without
being described as a verifier.
train.py · executed by E0006 (development, track modern) at commit ea61ca951af8 · sha256 afed1436a0f3…
"""The only per-candidate mutable surface in a Klein v2 study."""
from __future__ import annotations
import os
import time
import kleinlib
from kleinlib.contract import load_contract
from kleinlib.data import load_partition
from lib.iris import fit_and_score, frontier_extra
from sklearn.metrics import roc_auc_score
SMOKE = os.environ.get("KLEIN_SMOKE") == "1"
EXPERIMENT_ID = os.environ.get("KLEIN_EXPERIMENT_ID") or ("SMOKE" if SMOKE else None)
TRACK = os.environ.get("KLEIN_TRACK") or ("modern" if SMOKE else None)
# ---------------------------------------------------------------------------
# E0002-E0006, `modern` track (research_plan.md Phase `parade`, steps 5-6).
#
# ONE falsifiable idea per candidate: which post-1936 recipe is fit and
# scored against Fisher's own `lda_all4`, refit on the SAME development rows
# inside the SAME run (paired by construction). This is the whole
# per-experiment diff for this phase -- everything else in `run_modern_
# frontier_cell` below is fixed machinery, unchanged run to run.
#
# E0002 lda_all4 -- seeds the frontier; reference IS the candidate (P4)
# E0003 logreg_l2 -- P5
# E0004 knn5 -- P6
# E0005 svm_rbf -- P7
# E0006 hgbt -- P8
# ---------------------------------------------------------------------------
MODERN_RECIPE = "hgbt" # E0006: histogram gradient-boosted tree vs Fisher's LDA (P8)
def run_modern_frontier_cell(evaluation_kind: str, t0: float) -> float:
"""`modern` track cell: fit `MODERN_RECIPE`, refit `lda_all4` as the
reference on the SAME rows in the SAME run, and print both scores plus
`delta_vs_reference`/`delta_in_floors` (the latter only once
`minimum_delta > 0` -- currently 0, so P4-P8's rule keys read
INCONCLUSIVE by their own stated `inconclusive_if`, per program.md's
dated Decision).
"""
X_fit, X_eval, y_fit, y_eval = load_partition(evaluation_kind, study_dir=".")
y_eval_arr = y_eval.to_numpy()
minimum_delta = float(
load_contract(".")["tracks"]["modern"]["metric"].get("minimum_delta") or 0.0
)
model, p_eval, fit_seconds = fit_and_score(MODERN_RECIPE, X_fit, y_fit, X_eval)
candidate_auc = float(roc_auc_score(y_eval_arr, p_eval))
if MODERN_RECIPE == "lda_all4":
# E0002 seeds the frontier with Fisher's own recipe -- the reference
# IS the candidate, so no second fit is needed.
reference_auc = candidate_auc
else:
_, p_reference, _ = fit_and_score("lda_all4", X_fit, y_fit, X_eval)
reference_auc = float(roc_auc_score(y_eval_arr, p_reference))
y_pred = (p_eval >= 0.5).astype(int)
val_accuracy = float((y_pred == y_eval_arr).mean())
val_errors = int((y_pred != y_eval_arr).sum())
extra = frontier_extra(
reference_metric=reference_auc,
candidate_metric=candidate_auc,
minimum_delta=minimum_delta,
val_accuracy=val_accuracy,
val_errors=val_errors,
ideal=1.0,
)
return kleinlib.eval.evaluate(
model,
X_eval,
y_eval,
exp_id=EXPERIMENT_ID,
study_dir=".",
t0=t0,
fit_seconds=fit_seconds,
train_n=len(X_fit),
val_n=len(X_eval),
metric_name="val_auc",
metric_goal="higher",
extra=extra,
)
def main() -> None:
t0 = time.time()
evaluation_kind = os.environ.get("KLEIN_EVALUATION_KIND")
if SMOKE:
evaluation_kind = evaluation_kind or "development"
missing = [
name
for name, value in (
("KLEIN_EVALUATION_KIND", evaluation_kind),
("KLEIN_EXPERIMENT_ID", EXPERIMENT_ID),
("KLEIN_TRACK", TRACK),
)
if value is None
]
if missing:
raise RuntimeError(
"train.py must be invoked through `klein run-one`. For a pre-run "
"syntax/shape check use `KLEIN_SMOKE=1 python train.py` — it prints "
"the canonical block, writes no sidecars or snapshots, and is not "
"evidence. Missing: " + ", ".join(missing)
)
if TRACK == "modern":
run_modern_frontier_cell(evaluation_kind, t0)
return
raise NotImplementedError(
f"KLEIN_TRACK={TRACK!r}: only the `modern` frontier cell (Phase `parade`) "
"exists in train.py right now -- the `fisher` anchor cell (E0001) and the "
"`ablation` cells are separate candidate transactions in their own phases "
"(research_plan.md's experiment ladder)."
)
if __name__ == "__main__":
main()
Five things worth stealing
- Keep the recipes and the printed-key shapes out of the mutable surface.
lib/iris.pyowns the five model factories, the three feature sets, both bootstrap helpers and the fourextra={...}assembly functions (anchor_extra,frontier_extra,ablation_extra,sealed_extra), and it was complete and unedited before E0001 ran. Every per-experiment diff in this study is therefore “which recipe, which feature set, which reference” — never a new implementation smuggled in beside a candidate change. - Read the floor from the contract; never hardcode it.
train.pyloadsminimum_deltawithload_contract(".")["tracks"]["modern"]["metric"].get("minimum_delta") or 0.0on every single run. Before Phase 0 measured it, this evaluated to0.0by the same idiom every other Klein study uses for an unmeasured floor — which is precisely how this study surfaced a MEASURED zero as a live, undistinguished contract state rather than crashing on a missing key. - Guard the floor-normalized keys, and let a missing key mean
inconclusive.
lib.iris.frontier_extraonly addsdelta_in_floors/gap_in_floorsto the printed block whenminimum_delta > 0:
That single guard is why P4–P8 read inconclusive rather than crashing on a zero-division, and it is a direct, disclosed defensive pattern this study borrowed from an earlier study's ownif minimum_delta and minimum_delta > 0: extra["delta_in_floors"] = round( (float(candidate_metric) - float(reference_metric)) / minimum_delta, 4 ) extra["gap_in_floors"] = round((float(ideal) - float(reference_metric)) / minimum_delta, 4)train.py. - Refit the reference inside the same cell, on the same rows. Every
modernandablationcell fits its candidate and re-fitslda_all4in the same process, on the sameX_fit/X_evalarrays, before computing any delta. A comparison assembled later from two separate log files is not paired; it is two numbers that happen to be near each other. That is what makesdelta_in_floorscomparable to a paired-bootstrap floor measured the same way at Phase 0. - Route every partition through
load_partition, and read its printed fingerprint. It printssplit_fingerprint:before anything else, and the notary checks that value against the one the data gate froze.KLEIN_SEALED_DRYRUN=1answers afinal_testrequest with development data plus asealed_dryrun: 1line, so--final-test --dry-runexercises the whole code path and spends nothing — the one sanctioned rehearsal, run three times in this study before any of the three real sealed accesses.
Pitfalls this study actually hit
- A measured floor of exactly zero is a state your disposition rule has to
handle, not a state that handles itself.
choose_disposition's ordinary frontier arithmetic,primary_metric >= incumbent + minimum_delta, is exactly right when the floor is positive and becomes a non-strict comparison a tie satisfies the moment the floor is zero. If a floor can plausibly measure to zero on your data, decide in advance whether a tie should file as a keep, and say so on the record before the first run that could produce one — this study discovered the answer four keeps into the parade rather than one. - A duplicate row is a leakage bug even when the fix costs one row.
The data gate's mechanized four-row audit failed unconditionally on the pre-fix
table; the fix was a one-line
DataFrame.duplicated(keep="first")call inprepare.py, with zero information cost and no contract edit. Run the check before trusting any small table, even one this well known. - The paired-bootstrap statistic for an AUC difference is not the library's
default row-mean statistic. An AUC floor needs the SAME resampled index
applied to the labels and to both score vectors together
(
lib.iris.paired_bootstrap_auc_deltaspells this out once, rather than duplicating it in every sweep script), and a degenerate single-class resample has to be redrawn rather than allowed to makeroc_auc_scoreundefined — rare at 13-versus-12 on 25 rows, but rare is exactly the class of event that should never crash a Phase 0 sweep at the end of a long run. - A sealed cell that also fits a development-side reference will print two
split_fingerprint:lines. E0011 needed an in-run development LDA to compute itssealed_extrablock, so its log prints the development fingerprint first and the sealed one second. The manifest still records the correct (sealed) fingerprint, but a check that reads the first printed fingerprint rather than the last would misjudge a perfectly healthy run.
Next steps + references
What to try next, in priority order
- Re-run the identical parade with a primary metric that cannot peg.
This is the direct repair of the pegging finding. Log-loss or Brier score on the same
49/25/25 partition is unbounded below only by perfection, and both were already
observed to vary widely across these same five recipes while ROC-AUC sat frozen at
1.000000: development log-loss ranges from0.012827to0.172887, Brier from0.000945to0.056. A paired-bootstrap floor on(lda_all4, hgbt)under log-loss would almost certainly be non-degenerate, restoringdelta_in_floorsand every prediction rule built on it. Register both a floors rule and a raw-delta twin, so a future degenerate floor cannot silence a prediction outright. - Measure how much of the pegging is the 25-row block and how much is the
species pair. A registered
estimatetrack with a split-lottery over many more redraws than this study's five, inside the non-sealed rows, reporting the distribution oflda_all4's development AUC and of its threshold-0.5error count — the error count is the one statistic this study already showed moving (one flower on development, two on the sealed block) where the AUC did not. - Retest the ablation with a floor recipe that is not measured on the contrast under test. This study's ablation floor was set by the same paired comparison it then had to adjudicate, making the one-floor bar unreachable for a genuinely large effect. Measure the floor instead on a null contrast — the same feature set against itself across bootstrap draws — so the bar reflects noise rather than the effect's own tail, then re-adjudicate the sepal clauses against it.
- Add the one recipe this contract deliberately excluded. A tabular foundation model pre-trained for exactly this row-count regime is the honest 2025-era frontier answer and was named in the method card specifically as outside this study's parade, because adding a sixth recipe after the gate would be a contract change. A fresh study can register it at consult. Under a non-pegging metric, it is the one candidate with a plausible route to a resolvable win — and if it too ties Fisher's 1936 discriminant on a metric with headroom, that is a far stronger statement than this study could make.
Verified references
Every row below was checked against a publisher, archive or proceedings page on the date
recorded in references.yaml — eighteen entries, eighteen verified, none
UNVERIFIED, matching the method card's refs_verified: true.
- Fisher, R. A. (1936). The use of multiple measurements in taxonomic problems. Annals of Eugenics 7(2), 179–188. doi:10.1111/j.1469-1809.1936.tb02137.x — the incumbent this whole study is measured against, read from the original archive scan rather than from memory.
- Anderson, E. (1935). The irises of the Gaspé Peninsula. Bulletin of the American Iris Society 59, 2–5 — where the 150 flowers actually came from.
- Welch, B. L. (1939). Note on discriminant functions. Biometrika 31(1/2), 218–220. doi:10.2307/2334985 — the decision-theoretic statement behind LDA's plug-in Bayes optimality under equal covariances.
- Berkson, J. (1944). Application of the logistic function to bio-assay. Journal of
the American Statistical Association 39(227), 357–365.
doi:10.1080/01621459.1944.10500699 — primary reference for
logreg_l2. - Cox, D. R. (1958). The regression analysis of binary sequences. Journal of the Royal Statistical Society Series B 20(2), 215–232. doi:10.1111/j.2517-6161.1958.tb00292.x — the regression formulation of the logistic model as it is used today.
- Fix, E. & Hodges, J. L. (1951). Discriminatory analysis — nonparametric discrimination: consistency properties. USAF School of Aviation Medicine, Project 21-49-004, Report No. 4; reprinted International Statistical Review 57(3), 238–247 (1989). doi:10.2307/1403797 — where the nearest-neighbour rule was defined.
- Cover, T. M. & Hart, P. E. (1967). Nearest neighbor pattern classification. IEEE Transactions on Information Theory 13(1), 21–27. doi:10.1109/TIT.1967.1053964 — the asymptotic bound that makes kNN respectable, and why it buys nothing at 49 fitting rows.
- Boser, B. E., Guyon, I. M. & Vapnik, V. N. (1992). A training algorithm for optimal margin classifiers. Proc. COLT '92, 144–152. doi:10.1145/130385.130401 — the kernel trick applied to maximum-margin classification.
- Cortes, C. & Vapnik, V. (1995). Support-vector networks. Machine
Learning 20(3), 273–297. doi:10.1007/BF00994018 — the soft-margin
SVM as implemented in
sklearn.svm.SVC. - Friedman, J. H. (2001). Greedy function approximation: a gradient boosting machine.
Annals of Statistics 29(5), 1189–1232. doi:10.1214/aos/1013203451
— gradient boosting as stagewise steepest descent, primary reference for
hgbt. - Ke, G. et al. (2017). LightGBM: a highly efficient gradient boosting decision tree.
NeurIPS 2017, 3146–3154 — the histogram-binned design
HistGradientBoostingClassifieris modelled on. - Hanley, J. A. & McNeil, B. J. (1982). The meaning and use of the area under a ROC curve. Radiology 143(1), 29–36. doi:10.1148/radiology.143.1.7063747 — ROC-AUC as the Mann–Whitney statistic, and the source of this study's 156-ordered-pair resolution.
- Efron, B. (1979). Bootstrap methods: another look at the jackknife. Annals of Statistics 7(1), 1–26. doi:10.1214/aos/1176344552 — the resampling argument behind every floor this study measured, and behind its own known blind spot on a perfectly rank-separated sample.
- Grinsztajn, L., Oyallon, E. & Varoquaux, G. (2022). Why do tree-based models still outperform deep learning on typical tabular data? NeurIPS Datasets & Benchmarks. arXiv:2207.08815 — read honestly here: its own explanation of why trees win predicts they should do worse on this table, not better.
- Fernández-Delgado, M., Cernadas, E., Barro, S. & Amorim, D. (2014). Do we need hundreds of classifiers to solve real world classification problems? JMLR 15(90), 3133–3181 — 179 classifiers, 121 datasets, leader margins frequently smaller than dataset-to-dataset variation; this study is one more row of that table.
- Hollmann, N. et al. (2025). Accurate predictions on small data with a tabular foundation model. Nature 637(8045), 319–326. doi:10.1038/s41586-024-08328-6 — the honest 2025-era frontier for this table size, deliberately outside this study's fixed parade.
- Bezdek, J. C., Keller, J. M., Krishnapuram, R., Kuncheva, L. I. & Pal, N. R. (1999). Will the real iris data please stand up? IEEE Transactions on Fuzzy Systems 7(3), 368–369. doi:10.1109/91.771092 — the documented UCI-versus-original discrepancy this study's own data gate independently re-derived and confined to two setosa rows.
- Pedregosa, F. et al. (2011). Scikit-learn: machine learning in Python. JMLR 12, 2825–2830 — the implementation every recipe in this study runs through, and the one whose LDA solver this study's own from-scratch numpy implementation was checked against.