Skip to content

refactor: split recommend_bucketed_config into search + aggregation - #126

Merged
jc-macdonald merged 1 commit into
mainfrom
feat/split-recommend-bucketed-config
Aug 21, 2026
Merged

refactor: split recommend_bucketed_config into search + aggregation#126
jc-macdonald merged 1 commit into
mainfrom
feat/split-recommend-bucketed-config

Conversation

@jc-macdonald

Copy link
Copy Markdown
Collaborator

Summary

recommend_bucketed_config() (#123) ran an expensive per-regime run_adaptive search and immediately, irreversibly aggregated the results into whatever bucket_fn grouping 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_adaptive per regime, picks each regime's best trial)
  • aggregate_bucketed_config(): pure post-processing over that output (groups + aggregates by bucket_fn)

recommend_bucketed_config() is now a thin wrapper composing both, unchanged for existing callers. A caller who wants to experiment with grouping calls recommend_per_regime() once and re-aggregates as many times as needed for free.

Test plan

  • just ci passes, regime.py at 100% coverage
  • New tests: the split functions produce identical output to the combined wrapper; re-aggregating the same search results with a different bucket_fn needs no new search calls and each regime-as-its-own-bucket grouping returns its best config verbatim

🤖 Generated with Claude Code

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>
@jc-macdonald
jc-macdonald merged commit 482fac5 into main Aug 21, 2026
4 checks passed
@jc-macdonald
jc-macdonald deleted the feat/split-recommend-bucketed-config branch August 21, 2026 12:38
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