Skip to content

Add ARD support to bayes_search and related policies#89

Merged
yomichi merged 8 commits intodevelopfrom
ard
Mar 13, 2026
Merged

Add ARD support to bayes_search and related policies#89
yomichi merged 8 commits intodevelopfrom
ard

Conversation

@yomichi
Copy link
Copy Markdown
Contributor

@yomichi yomichi commented Mar 9, 2026

Instead of the Gaussian kernel

$$ k(\vec{x}, \vec{x}') = \lambda^2 \exp \left[-\frac{1}{2} \frac{|\vec{x} - \vec{x}'|^2}{\eta^2} \right], $$

the ARD kernel

$$ k(\vec{x}, \vec{x}') = \lambda^2 \exp \left[-\frac{1}{2} \sum_i \frac{(x_i - x_i')^2}{\eta_i^2} \right] $$

is now available by passing ard=True to bayes_search method of each Policy.

A new method policy.get_kernel_length_scale returns $\vec{\eta}$, which reflects sensiblity of each dimension of input to the objective function.

yomichi added 4 commits March 6, 2026 17:07
- Add ard=False to bayes_search() in all six policy classes
  (discrete, range, discrete_multi, range_multi, discrete_unified, range_unified)
- Introduce _make_gp_predictor(num_dim=None) in discrete and range policies
  to create GP predictor with optional ARD (Automatic Relevance Determination)
- When ard=True, use Gauss kernel with per-dimension width; require training
  data (e.g. from random_search) before bayes_search for input dimension
- Add test_bayes_search_ard to verify ard=True sets predictor with ARD kernel

Made-with: Cursor
- Add ard=False parameter to bayes_search in discrete, range, discrete_multi, range_multi policies
- Add get_kernel_length_scale() to policy for inspecting learned kernel width(s)
- Add ard_example.py: compare ard=True vs ard=False (best value, length scale, permutation importance)
- Add unit test for get_kernel_length_scale

Made-with: Cursor
…model

- Add _make_gp_model() to discrete and range policies; use it for both GP and BLM.
- When num_rand_basis > 0 and ard=True, pass ARD GP model to blm_predictor so
  random feature expansion uses per-dimension length scales.
- _make_gp_model(ard=False) now returns the default GP model instead of None.
- _make_gp_predictor always uses the model from _make_gp_model.
- Apply BLM+ARD init in discrete_multi, range_multi, discrete_unified, range_unified.
- Simplify ard and get_kernel_length_scale docstrings.

Made-with: Cursor
@yomichi yomichi marked this pull request as draft March 9, 2026 07:47
@yomichi yomichi requested a review from Copilot March 9, 2026 07:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Automatic Relevance Determination (ARD) support to PHYSBO's Bayesian optimization framework. ARD enables per-dimension length scales in the Gaussian kernel, allowing the GP surrogate to automatically identify which input dimensions are relevant to the objective function.

Changes:

  • Added ard=True parameter to bayes_search method across all 6 policy classes (discrete, discrete_multi, discrete_unified, range, range_multi, range_unified)
  • Added get_kernel_length_scale() method to retrieve learned length scales from the GP model in all policy variants
  • Added _make_gp_model and _make_gp_predictor helper methods to create GP models/predictors with optional ARD kernel
  • Added documentation (English/Japanese tutorials), example script, and unit tests for the new functionality

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/physbo/search/discrete/_policy.py Core ARD support: ard param in bayes_search, get_kernel_length_scale, _make_gp_model, _make_gp_predictor
src/physbo/search/range/_policy.py Mirror of discrete's ARD support for continuous search space policies
src/physbo/search/discrete_multi/_policy.py ARD in multi-objective discrete search; overrides get_kernel_length_scale for list return
src/physbo/search/range_multi/_policy.py ARD in multi-objective range search; overrides get_kernel_length_scale for list return
src/physbo/search/discrete_unified/_policy.py ARD in unified-objective discrete search (inherits get_kernel_length_scale)
src/physbo/search/range_unified/_policy.py ARD in unified-objective range search (inherits get_kernel_length_scale)
tests/unit/test_policy.py Unit tests for ARD kernel creation and get_kernel_length_scale (discrete only)
examples/single_objective/ard_example.py Example script demonstrating ARD vs isotropic kernel
docs/sphinx/manual/en/source/notebook/tutorial_ard.ipynb English ARD tutorial notebook
docs/sphinx/manual/ja/source/notebook/tutorial_ard.ipynb Japanese ARD tutorial notebook
docs/sphinx/manual/en/source/notebook/index.rst Add ARD tutorial to English docs index
docs/sphinx/manual/ja/source/notebook/index.rst Add ARD tutorial to Japanese docs index

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Add Model.create_default(ard=False, num_dim=None) in gp.core._model
  to build default Gauss kernel + Const mean + Gauss likelihood.
- Remove _make_gp_model from discrete and range policies; use
  gp.core.Model.create_default(ard=..., num_dim=...) instead.
- Update discrete_multi, range_multi, discrete_unified, range_unified
  to call Model.create_default for BLM+ARD predictor init.
- Add gp import where needed in multi/unified policy modules.

Made-with: Cursor
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

yomichi and others added 2 commits March 9, 2026 17:31
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- range: remove num_dim from _init_predictor and _make_gp_predictor;
  add _make_blm_predictor(); both use self.ard and self.get_num_dim().
- range_multi, range_unified: create BLM predictor via _make_blm_predictor()
  instead of inline create_default; drop unused gp import.

Made-with: Cursor
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yomichi yomichi marked this pull request as ready for review March 10, 2026 03:04
@yomichi yomichi merged commit 16e78ff into develop Mar 13, 2026
32 checks passed
@yomichi yomichi deleted the ard branch April 8, 2026 01:33
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.

2 participants