in ax/modelbridge/base.py [0:0]
def update(self, new_data: Data, experiment: Experiment) -> None:
"""Update the model bridge and the underlying model with new data. This
method should be used instead of `fit`, in cases where the underlying
model does not need to be re-fit from scratch, but rather updated.
Note: `update` expects only new data (obtained since the model initialization
or last update) to be passed in, not all data in the experiment.
Args:
new_data: Data from the experiment obtained since the last call to
`update`.
experiment: Experiment, in which this data was obtained.
"""
t_update_start = time.time()
observations = (
observations_from_data(
experiment=experiment,
data=new_data,
include_abandoned=self._fit_abandoned,
)
if experiment is not None and new_data is not None
else []
)
obs_feats_raw, obs_data_raw = self._extend_training_data(
observations=observations
)
obs_feats, obs_data, search_space = self._transform_data(
obs_feats=obs_feats_raw,
obs_data=obs_data_raw,
search_space=self._model_space,
transforms=self._raw_transforms,
transform_configs=self._transform_configs,
)
self._update(
search_space=search_space,
observation_features=obs_feats,
observation_data=obs_data,
)
self.fit_time += time.time() - t_update_start
self.fit_time_since_gen += time.time() - t_update_start