Skip to content

Support sequential domain reduction with mixed parameters - #633

Open
bingdongni wants to merge 1 commit into
bayesian-optimization:masterfrom
bingdongni:feature/mixed-domain-reduction
Open

bingdongni wants to merge 1 commit into
bayesian-optimization:masterfrom
bingdongni:feature/mixed-domain-reduction

Conversation

@bingdongni

@bingdongni bingdongni commented Nov 25, 2026 •

Copy link
Copy Markdown

Closes #620.

A tuning problem can now use sequential domain reduction on a float parameter alongside integer and categorical choices. The transformer updates just the float bounds. It reads the incumbent by parameter name, so a categorical parameter with several encoded columns can precede the float. A minimum window can be specified for the float parameters alone. All-discrete spaces still raise at initialization.

On loading a checkpoint, the optimizer uses each parameter's encoded mask to restore changed bounds. This keeps the discrete parameter types intact. The regression exercises optimization and a save/load round trip with scalar, sequence and keyed minimum windows.

Linux validation passed all 193 tests, including the example notebooks. As an end-to-end check, a random forest was tuned over a continuous sampling fraction, integer depth and categorical split criterion on scikit-learn's breast cancer dataset. The fraction range narrowed from [0.2, 1.0] to [0.2, 0.450], the discrete domains were preserved, and all seven recorded AUCs reproduced on re-evaluation.

Codex assisted with the implementation and tests.

Summary by CodeRabbit

  • New Features
    • Domain reduction now works with mixed parameter types, narrowing float ranges while preserving integer and categorical ranges.
    • Minimum window sizes can be configured with a single value or values matched to float parameters.
  • Bug Fixes
    • Restored optimization states now retain the correct transformed bounds, including when parameter ordering differs.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The domain reduction transformer now reduces float parameter bounds in spaces that also contain integer or categorical parameters. State loading groups transformed bounds by parameter masks. Tests cover minimum window inputs, unchanged non-float bounds, and save/load behavior.

Changes: Mixed-parameter domain reduction

Layer / File(s) Summary
Select and reduce float parameter bounds
bayes_opt/domain_reduction.py, tests/test_seq_domain_red.py
The transformer selects float parameters for domain reduction and rejects initialization when none exist. minimum_window accepts a scalar, a sequence matching the float parameter count, or a mapping keyed by float parameter. Integer and categorical domains remain unchanged.
Restore transformed bounds
bayes_opt/bayesian_optimization.py, tests/test_seq_domain_red.py
State loading groups encoded bounds by parameter masks and excludes bounds that match the current bounds. Tests check mixed-parameter bounds and maxima after save/load.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: t-muser, phi-friday, osullivryan

Merge Risk: Minimal · up to ba08e

This change lets sequential domain reduction work with mixed float, integer and categorical parameters, and it is covered by new tests, including save/load. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title states the main change: sequential domain reduction now supports mixed parameter spaces (float, integer, categorical). The raw summary shows the transformer now applies reduction only to Flo…
Linked Issues check Passed Issue #620 asks that domain reduction work when continuous and discrete parameters are combined. It suggests ignoring discrete parameters during reduction. At head, bayes_opt/domain_reduction.py colle…
Out of Scope Changes check Passed All changes described in the PR relate to #620. The domain_reduction.py change restricts reduction to float parameters and removes the rejection of mixed spaces. The minimum_window handling for float …
Full details: Title check

Explanation

The title states the main change: sequential domain reduction now supports mixed parameter spaces (float, integer, categorical). The raw summary shows the transformer now applies reduction only to FloatParameter entries and keeps other parameter domains unchanged, which matches the title. The title is short, specific, and does not mention unrelated work.

Full details: Linked Issues check

Explanation

Issue #620 asks that domain reduction work when continuous and discrete parameters are combined. It suggests ignoring discrete parameters during reduction. At head, bayes_opt/domain_reduction.py collects only FloatParameter keys in initialize(). It raises ValueError only when no float parameter exists, so mixed spaces are accepted. The _update() and transform() methods read the incumbent by these float keys and return bounds only for them. Integer and categorical parameters keep their original domains. The minimum_window input accepts a mapping keyed by float parameter, a sequence matching the float count, or a scalar. The AI-generated summary states that bayes_opt/bayesian_optimization.py _load_state_dict now restores changed bounds per parameter using encoded masks, and that tests/test_seq_domain_red.py covers mixed-parameter optimization and save/load. The domain_reduction.py behavior was read directly. The bayesian_optimization.py and test changes were not read, because diff and file reads for those changed blobs were unavailable; they rest on the summary. The end-to-end and CI claims in the PR description are not coding requirements and were not assessed.

Full details: Out of Scope Changes check

Explanation

All changes described in the PR relate to #620. The domain_reduction.py change restricts reduction to float parameters and removes the rejection of mixed spaces. The minimum_window handling for float parameters and the documentation update support that behavior. The bayesian_optimization.py change restores transformed float bounds on checkpoint load. This follows from the same float-only bounds design, so it is connected to the feature. The tests cover the new mixed-parameter behavior and the all-integer ValueError. No unrelated change was identified in the summaries. The bayesian_optimization.py and test file hunks were assessed from the AI-generated summary only, because their diffs were unavailable.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5a4a889f-28fb-4d55-8f20-0f91d4648216
Commits

Reviewing files that changed from the base of the PR and between ec45123 and ba08eb5.

Files selected for processing: 3

  • bayes_opt/bayesian_optimization.py
  • bayes_opt/domain_reduction.py
  • tests/test_seq_domain_red.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

This branch has not been deployed

No deployments
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.

Allow partial domain reduction when there is a combination of continous and discrete parameter

1 participant