Skip to content

Commit 0ce0ec2

Browse files
committed
Update ask/tell to suggest/ingest
1 parent 907003f commit 0ce0ec2

File tree

7 files changed

+16
-15
lines changed

7 files changed

+16
-15
lines changed

optimas/generators/ax/developer/multitask.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def _check_inputs(
260260
"to the number of high-fidelity trials"
261261
)
262262

263-
def ask(self, trials: List[Trial]) -> List[Trial]:
263+
def suggest(self, trials: List[Trial]) -> List[Trial]:
264264
"""Fill in the parameter values of the requested trials."""
265265
for trial in trials:
266266
next_trial = self._get_next_trial_arm()
@@ -275,7 +275,7 @@ def ask(self, trials: List[Trial]) -> List[Trial]:
275275
trial.trial_index = trial_index
276276
return trials
277277

278-
def tell(self, trials: List[Trial]) -> None:
278+
def ingest(self, trials: List[Trial]) -> None:
279279
"""Incorporate evaluated trials into experiment."""
280280
if self.gen_state == NOT_STARTED:
281281
self._incorporate_external_data(trials)

optimas/generators/ax/service/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def model(self) -> AxModelManager:
142142
"""Get access to the underlying model using an `AxModelManager`."""
143143
return self._model
144144

145-
def ask(self, num_points: Optional[int]) -> List[dict]:
145+
def suggest(self, num_points: Optional[int]) -> List[dict]:
146146
"""Request the next set of points to evaluate."""
147147
points = []
148148
for _ in range(num_points):
@@ -157,7 +157,7 @@ def ask(self, num_points: Optional[int]) -> List[dict]:
157157
points.append(point)
158158
return points
159159

160-
def tell(self, results: List[dict]) -> None:
160+
def ingest(self, results: List[dict]) -> None:
161161
"""Send the results of evaluations to the generator."""
162162
for result in results:
163163
trial = Trial.from_dict(

optimas/generators/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def ask_trials(self, n_trials: int) -> List[Trial]:
205205
if n_trials > self.n_queued_trials:
206206
n_gen = n_trials - self.n_queued_trials
207207
# Ask generator for n_gen points, using the standardized API
208-
gen_points = self.ask(n_gen)
208+
gen_points = self.suggest(n_gen)
209209
# Convert the points to the Trial format
210210
gen_trials = []
211211
for point in gen_points:
@@ -252,7 +252,7 @@ def tell_trials(
252252
253253
"""
254254
# Feed data to the generator, using the standardized API
255-
self.tell([trial.to_dict() for trial in trials])
255+
self.ingest([trial.to_dict() for trial in trials])
256256

257257
# Perform additional checks that rely on the trial format
258258
for trial in trials:
@@ -583,7 +583,7 @@ def get_libe_specs(self) -> Dict:
583583
libE_specs = {}
584584
return libE_specs
585585

586-
def ask(self, num_points: Optional[int]) -> List[dict]:
586+
def suggest(self, num_points: Optional[int]) -> List[dict]:
587587
"""Request the next set of points to evaluate.
588588
589589
Parameters
@@ -594,7 +594,7 @@ def ask(self, num_points: Optional[int]) -> List[dict]:
594594
"""
595595
return []
596596

597-
def tell(self, results: List[dict]) -> None:
597+
def ingest(self, results: List[dict]) -> None:
598598
"""
599599
Send the results of evaluations to the generator.
600600

optimas/generators/external.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ def __init__(
1616
)
1717
self.gen = ext_gen
1818

19-
def ask(self, n_trials):
19+
def suggest(self, n_trials):
2020
"""Request the next set of points to evaluate."""
21-
return self.gen.ask(n_trials)
21+
return self.gen.suggest(n_trials)
2222

23-
def tell(self, trials):
23+
def ingest(self, trials):
2424
"""Send the results of evaluations to the generator."""
25-
self.gen.tell(trials)
25+
self.gen.ingest(trials)
26+

optimas/generators/grid_sampling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def _create_configurations(self) -> None:
6767
all_configs.append(config)
6868
self._all_configs = all_configs
6969

70-
def ask(self, num_points: Optional[int]) -> List[dict]:
70+
def suggest(self, num_points: Optional[int]) -> List[dict]:
7171
"""Request the next set of points to evaluate."""
7272
points = []
7373
for _ in range(num_points):

optimas/generators/line_sampling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def _create_configurations(self) -> None:
103103
# Store configurations.
104104
self._all_configs = all_configs
105105

106-
def ask(self, num_points: Optional[int]) -> List[dict]:
106+
def suggest(self, num_points: Optional[int]) -> List[dict]:
107107
"""Request the next set of points to evaluate."""
108108
points = []
109109
for _ in range(num_points):

optimas/generators/random_sampling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __init__(
5757
self._rng = np.random.default_rng(seed)
5858
self._define_generator_parameters()
5959

60-
def ask(self, num_points: Optional[int]) -> List[dict]:
60+
def suggest(self, num_points: Optional[int]) -> List[dict]:
6161
"""Request the next set of points to evaluate."""
6262
configs = self._generate_sampling[self._distribution](num_points)
6363
points = []

0 commit comments

Comments
 (0)