smooth leaves by sample support, not cube root#98
Merged
Conversation
When a leave has too few samples to trust its mean, the generator borrows a value from its one-tile-swap neighbors -- smoothing. The old rule smoothed a leave when its draw-weighted count fell below the cube root of the total. That weight counts how often the leave can be drawn, not how many racks were actually sampled, so the rule smoothed about 80% of leaves even when every one was well covered -- pulling them toward their neighbors for no reason. Gate on the raw sample support instead: the total sampled count of the racks that feed the leave, against a fixed floor (WOLGES_GENERATE_SMOOTH_MIN, default 50). A well-sampled leave is now never smoothed; only a genuinely thin tail is filled in. The no-smooth path is untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The smoothing section still reported that smoothed and unsmoothed tables are a tie, at about 49.99 with 57 percent confidence. Those numbers were measured against the cube-root rule, which the previous commit replaced. They describe a table nobody builds any more: cube-root smoothed most of the table whether or not it needed it, so the comparison was between two heavily-altered tables, not between smoothing and its absence. Measured again against the rule that ships. The answer is sharper than a tie and points the other way: smoothing either wins outright or does nothing at all, and never costs anything. At 50000 games, where four leaves in five are too thin to trust, smoothed beats unsmoothed 51.6144 to 48.3856 over a million game pairs at 100 percent confidence. At 200000 games the lead narrows to 50.3209, still at 100 percent. At 20000000 games nothing is thin, nothing is smoothed, and the two commands write a byte-identical klv2. The advantage fades exactly as the thin leaves do -- 89 percent of leaves smoothed at 50000, 76 percent at 200000, none at 20000000 -- which is what a rule that only touches what it should looks like. Say so, and say why the choice barely is one. Below some volume the unsmoothed table does not merely carry noisier values -- for a leave no game ever dealt it has no value to report, and one has to be invented either way. The old figures are kept in parentheses, labelled as belonging to the rule they measured, rather than dropped outright. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a leave has too few samples to trust its mean, the generator borrows a value from its
one-tile-swap neighbors. The old rule smoothed a leave when its draw-weighted count fell
below the cube root of the total -- a weight that counts how often the leave can be drawn,
not how many racks were actually sampled. It smoothed about 80% of leaves even when every
one was well covered, replacing measured values with borrowed ones for no reason.
Gate on the raw sample support instead: the total sampled count of the racks feeding a
leave, against a floor (
WOLGES_GENERATE_SMOOTH_MIN, default 50).Changes
smooths nearly everything says so instead of doing it silently.
Correctness
The old "smoothed and unsmoothed play the same" figures were measured under the cube-root
rule and describe a table nobody builds now. Re-measured across the game count, each table
against its unsmoothed twin over a million game pairs:
Every row at or above 50, none below.
Test plan
english-generateandenglish-generate-no-smoothproduce abyte-identical klv2 (nothing is thin, so nothing is smoothed).