Skip to content

Commit

Permalink
fix: Introduce parameter to other optimizers for n batch
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiebergman committed Jan 8, 2025
1 parent 1d646ed commit d41daac
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions neps/optimizers/grid_search/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ def ask(
self,
trials: Mapping[str, Trial],
budget_info: BudgetInfo | None,
n: int | None = None,
) -> SampledConfig:
assert n is None, "TODO"
_num_previous_configs = len(trials)
if _num_previous_configs > len(self.configs_list) - 1:
raise ValueError("Grid search exhausted!")
Expand Down
2 changes: 2 additions & 0 deletions neps/optimizers/multi_fidelity/hyperband.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ def ask(
self,
trials: Mapping[str, Trial],
budget_info: BudgetInfo | None,
n: int | None = None,
) -> SampledConfig:
assert n is None, "TODO"
completed: dict[str, ConfigResult] = {
trial_id: trial.into_config_result(self.pipeline_space.from_dict)
for trial_id, trial in trials.items()
Expand Down
4 changes: 3 additions & 1 deletion neps/optimizers/multi_fidelity/ifbo.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,10 @@ def __init__(
def ask(
self,
trials: Mapping[str, Trial],
max_cost_total_info: BudgetInfo | None = None,
budget_info: BudgetInfo | None = None,
n: int | None = None,
) -> SampledConfig:
assert n is None, "TODO"
ids = [int(config_id.split("_", maxsplit=1)[0]) for config_id in trials]
new_id = max(ids) + 1 if len(ids) > 0 else 0

Expand Down
2 changes: 2 additions & 0 deletions neps/optimizers/multi_fidelity/successive_halving.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,10 @@ def ask(
self,
trials: Mapping[str, Trial],
budget_info: BudgetInfo | None,
n: int | None = None,
) -> SampledConfig:
"""This is basically the fit method."""
assert n is None, "TODO"
completed: dict[str, ConfigResult] = {
trial_id: trial.into_config_result(self.pipeline_space.from_dict)
for trial_id, trial in trials.items()
Expand Down
4 changes: 3 additions & 1 deletion neps/optimizers/multi_fidelity_prior/async_priorband.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,11 @@ def _update_sh_bracket_state(self) -> None:
def ask(
self,
trials: Mapping[str, Trial],
max_cost_total_info: BudgetInfo | None,
budget_info: BudgetInfo | None,
n: int | None = None,
) -> SampledConfig:
"""This is basically the fit method."""
assert n is None, "TODO"
completed: dict[str, ConfigResult] = {
trial_id: trial.into_config_result(self.pipeline_space.from_dict)
for trial_id, trial in trials.items()
Expand Down

0 comments on commit d41daac

Please sign in to comment.