Botorch preset#757
Conversation
a149bb3 to
c3885f6
Compare
c3885f6 to
4f4fd55
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new BOTORCH Gaussian Process preset intended to exactly mirror BoTorch GP behavior (single- and multi-task), alongside supporting kernel-factory refactors and validation improvements.
Changes:
- Introduce
GaussianProcessPreset.BOTORCHand implement BoTorch-aligned kernel / mean / likelihood factories (including custom GPyTorch components for multitask mean + likelihood). - Add parameter-kind classification (
ParameterKind) and automatic parameter-kind validation for kernel factories via a new_KernelFactorybase. - Extend tests (BoTorch parity + kernel-factory validation) and update the Streamlit surrogate-model demo to expose GP presets and multitask/transfer-learning toggles.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
baybe/surrogates/gaussian_process/presets/botorch.py |
Adds BoTorch preset factories for kernel/mean/likelihood. |
baybe/surrogates/gaussian_process/components/_gpytorch.py |
Introduces custom GPyTorch mean + multitask likelihood helper to match BoTorch behavior. |
baybe/surrogates/gaussian_process/components/kernel.py |
Adds _KernelFactory w/ parameter-kind validation; adjusts ICMKernelFactory. |
baybe/surrogates/gaussian_process/presets/{edbo,edbo_smoothed}.py |
Migrates kernel factories to _KernelFactory and updates dimension logic. |
baybe/surrogates/gaussian_process/presets/{core,__init__.py} |
Adds BOTORCH enum entry and re-exports preset factories. |
baybe/parameters/{enum,base.py} |
Adds ParameterKind and exposes Parameter.kind. |
baybe/parameters/selectors.py |
Removes _ParameterSelectorMixin (superseded by _KernelFactory). |
tests/test_gp.py |
Adds parity test asserting BOTORCH preset reproduces BoTorch posterior stats. |
tests/test_kernel_factories.py |
Adds tests for kernel-factory parameter-kind validation. |
streamlit/surrogate_models.py |
Adds GP preset selector + multitask / transfer-learning UI and logic. |
docs/conf.py |
Updates nitpick ignore list for refactor. |
CHANGELOG.md |
Documents new presets and kernel-factory parameter-kind validation. |
Comments suppressed due to low confidence (1)
baybe/surrogates/gaussian_process/presets/edbo.py:85
effective_dimsis computed astrain_x.shape[-1], which includes the task feature column in transfer-learning searchspaces. Since this factory explicitly excludesTaskParameterviaparameter_selector, the priors should likely be based on the non-task dimensionality (i.e. exclude the task feature) to avoid skewing the dimension-dependent prior heuristics. Consider derivingeffective_dimsfrom the selected non-task dimensions instead (e.g., subtract task dims or count comp-rep columns for selected parameters).
effective_dims = train_x.shape[-1]
switching_condition = _contains_encoding(
searchspace.discrete, _EDBO_ENCODINGS
) and (effective_dims >= 50)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
680d8a1 to
eeaa63d
Compare
e409228 to
eeaa63d
Compare
AVHopp
left a comment
There was a problem hiding this comment.
The streamlit changes should be a separate PR as they have nothing to do with new presets. I do see the value in extending the streamlit but those two things should still not be combined imo.
eeaa63d to
7bb590b
Compare
AVHopp
left a comment
There was a problem hiding this comment.
Two bugs or uncatched errors in the streamlit
Scienfitz
left a comment
There was a problem hiding this comment.
sneaky global change to mll is not acceptable
7ac4c25 to
9b90df2
Compare
71b8c2b to
5c1f0c9
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
baybe/surrogates/gaussian_process/core.py:193
fit_criterion_factorychanged its init alias fromcriterion_or_factorytofit_criterion_or_factory, which is a breaking change for any callers still using the old keyword. If this is intended, consider keepingcriterion_or_factoryas a deprecated alias (or otherwise providing a compatibility shim) so existing user code/configs don’t fail on upgrade.
fit_criterion_factory: FitCriterionFactoryProtocol = field(
alias="fit_criterion_or_factory",
factory=BayBEFitCriterionFactory,
converter=partial( # type: ignore[misc]
to_component_factory, component_type=GPComponentType.CRITERION
),
validator=is_callable(),
)
Now properly handles the regular/task parameter split
baa28f7 to
7996e1e
Compare
4e2c202 to
2deed6c
Compare
DevPR, parent is #745
Adds the
BOTORCHpreset for GPs.Important information
this is the BoTorch behaviorseems like a bad idea. The test ensures this explicitly.