Skip to content

0.9.2: keep a rare two-valued column's bin in the WoE floor - #81

Merged
orgoca merged 2 commits into
mainfrom
fix/reference-two-valued-columns
Oct 11, 2026
Merged

orgoca merged 2 commits into
mainfrom
fix/reference-two-valued-columns

Conversation

@orgoca

@orgoca orgoca commented Oct 11, 2026

Copy link
Copy Markdown
Owner

A patch: the WoE floor no longer ignores rare 0/1 columns. No change to the runtime, the exporters, the artifact schema, or the benchmark, whose features are all continuous.

The bug

fit_reference bins each feature with a shallow tree whose leaves must hold at least 2% of rows. A two-valued column whose rarer value fell below 2% couldn't be split, so it landed in one bin and carried no information.

This surfaced in the #76 gate experiment on Diabetes 130-US Hospitals. One-hot columns for rare discharge outcomes were lost, among them patients who died: 1.5% of rows, never readmitted. The same split, on all patients:

Floor, Report Gini
0.9.1 0.2353
0.9.1 with 0.5% bins (a workaround) 0.2958
0.9.2 0.2998
plain logistic regression on the same matrix, for scale 0.3105

This matters because compile_selected's floor gate compares against this model, and so does check 10 when given a fitted reference. A weakened floor let through artifacts a fair one would have stopped. 0.9.1 also advises adding 0/1 missing-indicator columns, which is exactly the kind of column the floor dropped.

The fix

A column with exactly two values is already binned, so it's cut between the two values, where the tree would, whatever the rarer one's share. The 2% minimum still governs the cut points a tree chooses on columns with more values, which is what it exists for. A 0/1 column the tree could already split gets the same cut as before.

Behaviour change: on data with rare two-valued columns, the floor gets stronger. A floor gate or check 10 that passed may now fail. That is the fix working, and the changelog says so.

Release

The second commit bumps to 0.9.2 (__init__, CITATION.cff, CHANGELOG). It also corrects 0.9.1's changelog date to its release day, 2026-10-10. The benchmark doesn't move; results.json stays as the 0.9.0 run.

Checks

  • New test: a 1%-share 0/1 column gets two bins and a nonzero coefficient. It fails on 0.9.1 (no bins) and passes here. A common 0/1 column keeps its 0.5 cut.
  • Full suite green locally; ruff and black clean.

fit_reference bins each feature with a shallow tree whose leaves must hold
at least 2% of rows. A two-valued column whose rarer value fell below 2%
could not be split, so it landed in one bin with no information and the
floor ignored it. On public hospital-readmission data (#76) that dropped
one-hot columns for rare discharge outcomes, including patients who died
(1.5% of rows, never readmitted), and held the floor's Gini at 0.235
instead of 0.300.

A column with exactly two values is already binned, so it is now cut
between the two values, where the tree would, whatever the rarer value's
share. The 2% minimum still governs the cut points a tree chooses on
columns with more values. A 0/1 column the tree could already split gets
the same cut as before, and data with only continuous columns, the
benchmark's included, is unaffected.
The WoE floor no longer ignores rare 0/1 columns. A patch release: no change
to the runtime, the exporters, the artifact schema, or the benchmark, whose
features are all continuous. On data with rare two-valued columns the floor
gets stronger, so a floor gate or check 10 that passed may now fail.

Also corrects 0.9.1's changelog date to its release day, 2026-10-10.
@orgoca
orgoca merged commit 00dcbbd into main Oct 11, 2026
20 checks passed
@orgoca
orgoca deleted the fix/reference-two-valued-columns branch October 11, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant