Skip to content

Commit

Permalink
Type annotation: Scheduler.get_pareto_optimal_parameters never return…
Browse files Browse the repository at this point in the history
…s None (#2740)

Summary:
Pull Request resolved: #2740

Fixing a type annotation.

Reviewed By: Balandat

Differential Revision: D62192596

fbshipit-source-id: 4e5ce9ac4d9f54e98a69b60f5beba7afa3a50b09
  • Loading branch information
esantorella authored and facebook-github-bot committed Sep 4, 2024
1 parent ac3a7ec commit 0b39250
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ax/service/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def get_pareto_optimal_parameters(
optimization_config: Optional[OptimizationConfig] = None,
trial_indices: Optional[Iterable[int]] = None,
use_model_predictions: bool = True,
) -> Optional[dict[int, tuple[TParameterization, TModelPredictArm]]]:
) -> dict[int, tuple[TParameterization, TModelPredictArm]]:
return self._get_pareto_optimal_parameters(
experiment=self.experiment,
generation_strategy=self.standard_generation_strategy,
Expand Down
7 changes: 4 additions & 3 deletions ax/service/utils/best_point_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def get_pareto_optimal_parameters(
optimization_config: Optional[OptimizationConfig] = None,
trial_indices: Optional[Iterable[int]] = None,
use_model_predictions: bool = True,
) -> Optional[dict[int, tuple[TParameterization, TModelPredictArm]]]:
) -> dict[int, tuple[TParameterization, TModelPredictArm]]:
"""Identifies the best parameterizations tried in the experiment so far,
using model predictions if ``use_model_predictions`` is true and using
observed values from the experiment otherwise. By default, uses model
Expand All @@ -158,12 +158,13 @@ def get_pareto_optimal_parameters(
observed values.
Returns:
``None`` if it was not possible to extract the Pareto frontier,
otherwise a mapping from trial index to the tuple of:
A mapping from trial index to the tuple of:
- the parameterization of the arm in that trial,
- two-item tuple of metric means dictionary and covariance matrix
(model-predicted if ``use_model_predictions=True`` and observed
otherwise).
Raises a `NotImplementedError` if extracting the Pareto frontier is
not possible. Note that the returned dict may be empty.
"""
pass

Expand Down

0 comments on commit 0b39250

Please sign in to comment.