Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi trust regions #773

Merged
merged 41 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
905dc14
multiTR with notebook
May 18, 2023
5c27203
notebook
May 18, 2023
e46150d
multi local step TREGO
Jun 2, 2023
ceadabe
Merge branch 'develop' into victor/trustregions
hstojic Jun 21, 2023
990b6cd
merged latest develop
hstojic Jun 30, 2023
ebe27f4
Refactor multi trust region implementation
khurram-ghani Jun 2, 2023
3ff37fe
Merge remote-tracking branch 'origin/develop' into khurram/trustregions
khurram-ghani Jul 26, 2023
683eacc
Fix formatting in notebook & remove orig TR changes
khurram-ghani Jul 26, 2023
809153c
Remove redundant new assert
khurram-ghani Jul 26, 2023
b6ee392
Undo earlier logging change
khurram-ghani Jul 26, 2023
fcc16e2
Workaround isort & black clash
khurram-ghani Jul 26, 2023
9f21527
Keep old ver of mypy happy
khurram-ghani Jul 26, 2023
1762d82
Fix typo in slicing
khurram-ghani Jul 26, 2023
535dbb1
Add new collection space tests
khurram-ghani Jul 27, 2023
5b97508
Merge branch 'develop' into khurram/trustregions
khurram-ghani Jul 31, 2023
c4ce7ab
Address feedback plus other small changes
khurram-ghani Aug 2, 2023
20b5687
Merge remote-tracking branch 'origin/develop' into khurram/trustregions
khurram-ghani Aug 2, 2023
0c38efb
Add TrustRegionBox/UpdateableSearchSpace unittests
khurram-ghani Aug 2, 2023
309ef09
Address feedback for space changes
khurram-ghani Aug 3, 2023
d58306e
Some updates to rule/utils from feedback
khurram-ghani Aug 4, 2023
c2abf11
Create subspaces outside the rule
khurram-ghani Aug 7, 2023
12c8f1f
Fix func to work with old tensorflow
khurram-ghani Aug 7, 2023
3c725bd
Add rule and optimizer unit tests
khurram-ghani Aug 7, 2023
be06c63
Add integ test
khurram-ghani Aug 8, 2023
a313bf8
Merge branch 'develop' into khurram/trustregions
khurram-ghani Aug 8, 2023
0706656
Add shape-checking/docstring for mask func
khurram-ghani Aug 8, 2023
9def562
Add check_shapes, update docstrings & add tag test
khurram-ghani Aug 8, 2023
0973630
Remove notebook, to be added in separate PR
khurram-ghani Aug 8, 2023
01f370b
Add deepcopy test
khurram-ghani Aug 8, 2023
dad0936
Merge remote-tracking branch 'origin/develop' into khurram/trustregions
khurram-ghani Aug 9, 2023
66b4aa4
Check TR copy is deep
khurram-ghani Aug 9, 2023
9bb6a80
Improve TR box and test slightly
khurram-ghani Aug 10, 2023
4924557
Address Uri's latest comments
khurram-ghani Aug 21, 2023
f0e125d
Move get_value_for_tag to more general utils/misc
khurram-ghani Aug 21, 2023
3daa81f
Remove redundant [] checks
khurram-ghani Aug 21, 2023
0b19246
Add fixture for default search space type
khurram-ghani Aug 21, 2023
044f07c
Add test for optim multiple boxes as a batch
khurram-ghani Aug 22, 2023
8ca39e9
Rename classes and expand some docstrings
khurram-ghani Aug 22, 2023
ef62eeb
Choose longer class name
khurram-ghani Aug 24, 2023
5634c85
Merge branch 'develop' into khurram/trustregions
khurram-ghani Aug 25, 2023
8f17839
Rename updatable class name
khurram-ghani Aug 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/integration/test_bayesian_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
BatchHypervolumeSharpeRatioIndicator,
DiscreteThompsonSampling,
EfficientGlobalOptimization,
MultiTrustRegionBox,
TrustRegion,
TrustRegionBox,
)
from trieste.acquisition.sampler import ThompsonSamplerFromTrajectory
from trieste.bayesian_optimizer import (
Expand Down Expand Up @@ -197,6 +199,17 @@ def GPR_OPTIMIZER_PARAMS() -> Tuple[str, List[ParameterSet]]:
TURBO(ScaledBranin.search_space, rule=DiscreteThompsonSampling(500, 3)),
id="Turbo",
),
pytest.param(
10,
MultiTrustRegionBox(
[TrustRegionBox(ScaledBranin.search_space) for _ in range(3)],
EfficientGlobalOptimization(
ParallelContinuousThompsonSampling(),
num_query_points=3,
),
),
id="MultiTrustRegionBox",
),
pytest.param(15, DiscreteThompsonSampling(500, 5), id="DiscreteThompsonSampling"),
pytest.param(
15,
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/acquisition/test_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
DiscreteSearchSpace,
LinearConstraint,
SearchSpace,
TaggedMultiSearchSpace,
TaggedProductSearchSpace,
)
from trieste.types import TensorType
Expand Down Expand Up @@ -203,6 +204,15 @@ def test_optimize_continuous_raises_with_invalid_vectorized_batch_size(batch_siz
generate_continuous_optimizer()(search_space, (acq_fn, batch_size))


def test_optimize_continuous_raises_with_mismatch_multi_search_space() -> None:
khurram-ghani marked this conversation as resolved.
Show resolved Hide resolved
space_A = Box([-1], [2])
space_B = Box([3], [4])
multi_space = TaggedMultiSearchSpace(spaces=[space_A, space_B])
acq_fn = _quadratic_sum([1.0])
with pytest.raises(TF_DEBUGGING_ERROR_TYPES, match="The batch shape of initial samples 2 must"):
generate_continuous_optimizer()(multi_space, acq_fn)


@pytest.mark.parametrize("num_optimization_runs", [1, 10])
@pytest.mark.parametrize("num_initial_samples", [1000, 5000])
def test_optimize_continuous_correctly_uses_init_params(
Expand Down
Loading
Loading