Skip to content

Commit af6f150

Browse files
vizier-teamcopybara-github
vizier-team
authored andcommitted
Trial and metric padding is not yet supported for multimetric problems in GP-UCB-PE.
PiperOrigin-RevId: 716793840
1 parent 5ab515f commit af6f150

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

vizier/_src/algorithms/designers/gp_ucb_pe.py

+18-8
Original file line numberDiff line numberDiff line change
@@ -655,14 +655,24 @@ def __attrs_post_init__(self):
655655
# Extra validations
656656
if self._problem.search_space.is_conditional:
657657
raise ValueError(f'{type(self)} does not support conditional search.')
658-
elif (
659-
len(self._problem.metric_information) != 1
660-
and self._config.optimize_set_acquisition_for_exploration
661-
):
662-
raise ValueError(
663-
f'{type(self)} works with exactly one metric when'
664-
' `optimize_set_acquisition_for_exploration` is enabled.'
665-
)
658+
elif len(self._problem.metric_information) != 1:
659+
if self._config.optimize_set_acquisition_for_exploration:
660+
raise ValueError(
661+
f'{type(self)} works with exactly one metric when'
662+
' `optimize_set_acquisition_for_exploration` is enabled.'
663+
)
664+
empty_labels = jnp.array([[]])
665+
padded_labels = self._padding_schedule.pad_labels(empty_labels)
666+
if padded_labels.shape[0] != empty_labels.shape[0]:
667+
raise ValueError(
668+
f'{type(self)} does not support trial padding for multimetric'
669+
' problems.'
670+
)
671+
if padded_labels.shape[1] != empty_labels.shape[1]:
672+
raise ValueError(
673+
f'{type(self)} does not support metric padding for multimetric'
674+
' problems.'
675+
)
666676

667677
# Extra initializations.
668678
# Discrete parameters are continuified to account for their actual values.

vizier/_src/algorithms/designers/gp_ucb_pe_test.py

-5
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ class GpUcbPeTest(parameterized.TestCase):
9090
iters=3,
9191
batch_size=3,
9292
num_metrics=2,
93-
applies_padding=True,
9493
multimetric_promising_region_penalty_type=(
9594
gp_ucb_pe.MultimetricPromisingRegionPenaltyType.UNION
9695
),
@@ -99,7 +98,6 @@ class GpUcbPeTest(parameterized.TestCase):
9998
iters=3,
10099
batch_size=3,
101100
num_metrics=2,
102-
applies_padding=True,
103101
ensemble_size=4,
104102
multimetric_promising_region_penalty_type=(
105103
gp_ucb_pe.MultimetricPromisingRegionPenaltyType.INTERSECTION
@@ -111,23 +109,20 @@ class GpUcbPeTest(parameterized.TestCase):
111109
num_seed_trials=5,
112110
num_metrics=2,
113111
multitask_type=mt_type.SEPARABLE_NORMAL_TASK_KERNEL_PRIOR,
114-
applies_padding=True,
115112
),
116113
dict(
117114
iters=3,
118115
batch_size=5,
119116
num_seed_trials=5,
120117
num_metrics=2,
121118
multitask_type=mt_type.SEPARABLE_LKJ_TASK_KERNEL_PRIOR,
122-
applies_padding=True,
123119
),
124120
dict(
125121
iters=3,
126122
batch_size=5,
127123
num_seed_trials=5,
128124
num_metrics=2,
129125
multitask_type=mt_type.SEPARABLE_DIAG_TASK_KERNEL_PRIOR,
130-
applies_padding=True,
131126
),
132127
)
133128
def test_on_flat_space(

0 commit comments

Comments
 (0)