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

Add delrelativize transform to EBAshr #3314

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
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