Skip to content

Commit

Permalink
Rename _ask to ask
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiLehe committed Jul 10, 2024
1 parent db6e2bc commit 522dd9c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion optimas/generators/ax/developer/multitask.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def _check_inputs(
"to the number of high-fidelity trials"
)

def _ask(self, trials: List[Trial]) -> List[Trial]:
def ask(self, trials: List[Trial]) -> List[Trial]:
"""Fill in the parameter values of the requested trials."""
for trial in trials:
next_trial = self._get_next_trial_arm()
Expand Down
2 changes: 1 addition & 1 deletion optimas/generators/ax/service/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def model(self) -> AxModelManager:
"""Get access to the underlying model using an `AxModelManager`."""
return self._model

def _ask(self, trials: List[Trial]) -> List[Trial]:
def ask(self, trials: List[Trial]) -> List[Trial]:
"""Fill in the parameter values of the requested trials."""
for trial in trials:
parameters, trial_id = self._ax_client.get_next_trial(
Expand Down
4 changes: 2 additions & 2 deletions optimas/generators/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def ask_trials(self, n_trials: int) -> List[Trial]:
)
)
# Ask the generator to fill them.
gen_trials = self._ask(gen_trials)
gen_trials = self.ask(gen_trials)
# Keep only trials that have been given data.
for trial in gen_trials:
if len(trial.parameter_values) > 0:
Expand Down Expand Up @@ -578,7 +578,7 @@ def get_libe_specs(self) -> Dict:
libE_specs = {}
return libE_specs

def _ask(self, trials: List[Trial]) -> List[Trial]:
def ask(self, trials: List[Trial]) -> List[Trial]:
"""Ask method to be implemented by the Generator subclasses.
Parameters
Expand Down
2 changes: 1 addition & 1 deletion optimas/generators/grid_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def _create_configurations(self) -> None:
all_configs.append(config)
self._all_configs = all_configs

def _ask(self, trials: List[Trial]) -> List[Trial]:
def ask(self, trials: List[Trial]) -> List[Trial]:
"""Fill in the parameter values of the requested trials."""
for trial in trials:
if self._all_configs:
Expand Down
2 changes: 1 addition & 1 deletion optimas/generators/line_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _create_configurations(self) -> None:
# Store configurations.
self._all_configs = all_configs

def _ask(self, trials: List[Trial]) -> List[Trial]:
def ask(self, trials: List[Trial]) -> List[Trial]:
"""Fill in the parameter values of the requested trials."""
for trial in trials:
if self._all_configs:
Expand Down
2 changes: 1 addition & 1 deletion optimas/generators/random_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __init__(
self._rng = np.random.default_rng(seed)
self._define_generator_parameters()

def _ask(self, trials: List[Trial]) -> List[Trial]:
def ask(self, trials: List[Trial]) -> List[Trial]:
"""Fill in the parameter values of the requested trials."""
n_trials = len(trials)
configs = self._generate_sampling[self._distribution](n_trials)
Expand Down

0 comments on commit 522dd9c

Please sign in to comment.