Skip to content

Commit

Permalink
ensure minimize is passed to make_experiment
Browse files Browse the repository at this point in the history
Summary: D52846021 introduced a bug where `minimize` is ignored if `objective_name` is not provided. This rectifies.

Differential Revision: D54559416
  • Loading branch information
bernardbeckerman authored and facebook-github-bot committed Mar 5, 2024
1 parent 39c6922 commit 8c49dea
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ax/service/managed_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@
get_best_parameters_from_model_predictions,
get_best_raw_objective_point,
)
from ax.service.utils.instantiation import InstantiationBase, TParameterRepresentation
from ax.service.utils.instantiation import (
DEFAULT_OBJECTIVE_NAME,
InstantiationBase,
TParameterRepresentation,
)
from ax.utils.common.executils import retry_on_exception
from ax.utils.common.logger import get_logger
from ax.utils.common.typeutils import not_none
Expand Down Expand Up @@ -99,14 +103,12 @@ def with_evaluation_function(
) -> "OptimizationLoop":
"""Constructs a synchronous `OptimizationLoop` using an evaluation
function."""
if objective_name is None:
objective_name = DEFAULT_OBJECTIVE_NAME
experiment = InstantiationBase.make_experiment(
name=experiment_name,
parameters=parameters,
objectives=(
{objective_name: "minimize" if minimize else "maximize"}
if objective_name
else None
),
objectives={objective_name: "minimize" if minimize else "maximize"},
parameter_constraints=parameter_constraints,
outcome_constraints=outcome_constraints,
)
Expand Down

0 comments on commit 8c49dea

Please sign in to comment.