feat: bound class sampler#253
Draft
selmanozleyen wants to merge 4 commits into
Draft
Conversation
Move the shared run-length/slice/mask machinery out of ClassSampler into a new _RunClassSampler base (subclassing BaseClassSampler) and relocate the reusable helpers into _utils. Pure relocation; ClassSampler behavior is unchanged.
Bind an inner class sampler's per-batch class schedule onto another obs table, matching classes by label (optionally on a subset of tuple positions via `on`) with optional secondary within-class weighting. Adds the supporting _utils helpers (project_index, grouped_weighted_choice, to_level_arrays, _as_multiindex) and exports BoundClassSampler.
Cover construction/validation, per-batch class replay, subset binding via `on`, within-class weighting, chaining, mask, and pickle/deepcopy round-trips for 100% line coverage of the sampler. Shared batch-iteration helpers keep the coherence checks deduplicated.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #253 +/- ##
==========================================
- Coverage 93.43% 92.08% -1.36%
==========================================
Files 15 17 +2
Lines 1432 1604 +172
==========================================
+ Hits 1338 1477 +139
- Misses 94 127 +33
🚀 New features to boost your workflow:
|
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.
Putting it here to share my WIP only. Will fill the body. I tried to split this into nice 3 commits for easier review