Skip to content

Commit

Permalink
Add delrelativize transform to EBAshr (#3314)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #3314

There was a bug that popped up recently that danielcohenlive noticed related to SOO exp not being able to generate candidates. This experiment ended up having a relative constraint in the opt config, which looks like we overlooked. We add that here

Reviewed By: danielcohenlive

Differential Revision: D69221574

fbshipit-source-id: 145bd619d396fd12f3c53f05459b32a2a5f4cbd8
  • Loading branch information
mgarrard authored and facebook-github-bot committed Feb 6, 2025
1 parent 0f8660a commit 01c6a73
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
6 changes: 6 additions & 0 deletions ax/modelbridge/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,17 @@
Discrete_X_trans: list[type[Transform]] = [IntRangeToChoice]

EB_ashr_trans: list[type[Transform]] = [
Derelativize, # necessary to support relative constraints
# scales data from multiple trials since we currently don't filter to single
# trial data
TransformToNewSQ,
# Ensure we pass unique arms to EBAshr. This assumes treatment effects are
# stationarity, but also should help with estimating the task-task covariance.
MergeRepeatedMeasurements,
SearchSpaceToChoice,
]

# TODO: @mgarrard remove this once non-gs methods are reaped
rel_EB_ashr_trans: list[type[Transform]] = [
Relativize,
MergeRepeatedMeasurements,
Expand Down
24 changes: 20 additions & 4 deletions ax/utils/testing/core_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,19 +253,23 @@ def get_branin_experiment(
with_completed_batch: bool = False,
with_completed_trial: bool = False,
num_arms_per_trial: int = 15,
with_relative_constraint: bool = False,
) -> Experiment:
search_space = search_space or get_branin_search_space(
with_fidelity_parameter=with_fidelity_parameter,
with_choice_parameter=with_choice_parameter,
with_str_choice_param=with_str_choice_param,
with_parameter_constraint=with_parameter_constraint,
)

exp = Experiment(
name="branin_test_experiment" if named else None,
search_space=search_space,
optimization_config=(
get_branin_optimization_config(minimize=minimize)
if has_optimization_config
get_branin_optimization_config(
minimize=minimize, with_relative_constraint=with_relative_constraint
)
if has_optimization_config or with_relative_constraint
else None
),
runner=SyntheticRunner(),
Expand Down Expand Up @@ -1716,8 +1720,20 @@ def get_optimization_config_no_constraints(
)


def get_branin_optimization_config(minimize: bool = False) -> OptimizationConfig:
return OptimizationConfig(objective=get_branin_objective(minimize=minimize))
def get_branin_optimization_config(
minimize: bool = False, with_relative_constraint: bool = False
) -> OptimizationConfig:
outcome_constraint = []
if with_relative_constraint:
outcome_constraint.append(
get_outcome_constraint(
metric=get_branin_metric(name="branin_d"), relative=True
)
)
return OptimizationConfig(
objective=get_branin_objective(minimize=minimize),
outcome_constraints=outcome_constraint,
)


def _validate_num_objectives(num_objectives: int) -> None:
Expand Down

0 comments on commit 01c6a73

Please sign in to comment.