refactor: split recommend_bucketed_config into search + aggregation - #126
Merged
Conversation
recommend_bucketed_config() ran an expensive per-regime run_adaptive search and immediately, irreversibly aggregated the results into whatever bucket_fn grouping was passed. Found this a real limitation deriving VBPCApy hyperparameter buckets: the first grouping (2 buckets, wide vs tall) performed badly for the most extreme regimes, and re-grouping (e.g. 4 buckets by extremity) meant re-running the whole search from scratch -- over an hour of compute -- just to try a different bucket_fn. Splits the function into recommend_per_regime() (the search) and aggregate_bucketed_config() (pure post-processing over its output), with recommend_bucketed_config() now a thin wrapper composing both for the common one-shot case. A caller who wants to experiment with grouping can call recommend_per_regime() once and re-aggregate as many times as needed for free. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
recommend_bucketed_config()(#123) ran an expensive per-regimerun_adaptivesearch and immediately, irreversibly aggregated the results into whateverbucket_fngrouping was passed in one call.Why this matters
Found this a real limitation deriving VBPCApy hyperparameter buckets for extreme-aspect-ratio data (yoavram-lab/VBPCApy#116): the first grouping (2 buckets, wide vs tall) performed badly for the most extreme regimes, and re-grouping (e.g. 4 buckets split by extremity) meant re-running the whole search from scratch -- over an hour of compute each time -- just to try a different
bucket_fn.Change
Splits
recommend_bucketed_config()into:recommend_per_regime(): the expensive search (run_adaptiveper regime, picks each regime's best trial)aggregate_bucketed_config(): pure post-processing over that output (groups + aggregates bybucket_fn)recommend_bucketed_config()is now a thin wrapper composing both, unchanged for existing callers. A caller who wants to experiment with grouping callsrecommend_per_regime()once and re-aggregates as many times as needed for free.Test plan
just cipasses,regime.pyat 100% coveragebucket_fnneeds no new search calls and each regime-as-its-own-bucket grouping returns its best config verbatim🤖 Generated with Claude Code