fix(pooling): exact within-model draw indices, keep score labels on-axis - #217
Merged
thomaspinder merged 1 commit intoJul 29, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feat/151-predictive-pooling #217 +/- ##
===========================================================
Coverage 94.7% 94.7%
===========================================================
Files 44 44
Lines 3009 3014 +5
Branches 376 377 +1
===========================================================
+ Hits 2851 2856 +5
Misses 114 114
Partials 44 44 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
thomaspinder
force-pushed
the
feat/151-predictive-pooling
branch
from
July 29, 2026 13:45
c35fc2d to
ba8129b
Compare
Closes #165: `_mixture_draws` picked the within-model draw index with `floor(rng.random(N) * sizes[membership])`. `rng.integers(0, sizes[membership])` is exact — no theoretical `index == size` rounding edge at extreme sizes — clearer, and equally vectorised. Pooled draws shift under a fixed seed; membership is drawn before the index, so it is unchanged. Closes #166: `plot_pool_weights` parked every score annotation at `w + 1%`, so a long label (`log score -1,234.5`) ran past the right axis when a model carried nearly all the weight. Bars covering more than 75% of the x-axis now label inside, right-aligned against the bar end and recoloured for contrast; shorter bars keep the outside placement. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Egjd7ToFeb9TQqFnfRQZxV
thomaspinder
force-pushed
the
fix/165-166-pooling-followups
branch
from
July 29, 2026 13:51
ae04c50 to
47ef90b
Compare
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
Two follow-ups on the pooling branch (#164), stacked on
feat/151-predictive-pooling:_mixture_drawsselected within-model indices viafloor(rng.random(N) * sizes); nowrng.integers(0, sizes[membership])— exact (no theoreticalindex == sizerounding edge), clearer, equally vectorised. Behaviour note:membershipis drawn before the index draw, so model membership under fixed seeds is bit-identical and only within-model positions shift — all 103 pre-existing pooling tests pass unmodified, and no doc pins the old mechanism.plot_pool_weightsplaced the score annotation atw + 1%with xlimmax(1, 1.05·w), overflowing the axis for weights near 1 (reproduced: label edge ~75 px past the axis). Labels now render inside the bar (right-aligned, white) when the bar exceeds 75% of the axis, outside otherwise. New test asserts alignment andget_window_extent().x1 <= ax.bbox.x1for both placements, red-verified against the pre-fix code.Closes #165
Closes #166
Gates
122 pooling+plotting tests green; branch fast suite 638 passed; ruff/ty clean.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Egjd7ToFeb9TQqFnfRQZxV