class boa.scheduler.Scheduler(experiment: Experiment, generation_strategy: GenerationStrategy, options: SchedulerOptions, db_settings: None = None, _skip_experiment_save: bool = False)[source]#

Bases: Scheduler

Parameters
  • experiment (Experiment) –

  • generation_strategy (GenerationStrategy) –

  • options (SchedulerOptions) –

  • db_settings (Optional[DBSettings]) –

  • _skip_experiment_save (bool) –

scheduler_filepath: str = 'scheduler.json'#
opt_filepath: str = 'optimization.csv'#
property wrapper: BaseWrapper#
report_results(force_refit: bool = False)[source]#

Ran whenever a batch of data comes in and the results are ready. This could be from one trial or a group of trials at once since it does interval polls to check trial statuses.

saves the scheduler to json and saves to the log a status update of what trials have finished, which are running, and what generation step will be used to generate the next trials.

Parameters

force_refit (bool) – Not used. Arg from Ax for compatibility.

best_fitted_trials(optimization_config: Optional[OptimizationConfig] = None, trial_indices: Optional[Iterable[int]] = None, use_model_predictions: bool = True, *args, **kwargs) dict[source]#

Identifies and fit the best parameterizations tried in the experiment so far, this model predictions (fitting) if use_model_predictions is true and using observed raw values from the experiment otherwise. By default, uses model predictions to account for observation noise.

If it is a Multi Objective Problem, then it will return the pareto front, a collection of trials that are the best front that min/maxes the objectives. Else it is the best point that min/maxes the objective.

NOTE: The format of this method’s output is as follows: { trial_index: {params: best parameters, means: dict of metrics by nam, cov_matrix: dict of cov matrix} },

Parameters
  • optimization_config (Optional[OptimizationConfig]) – Optimization config to use in place of the one stored on the experiment.

  • trial_indices (Optional[Iterable[int]]) – Indices of trials for which to retrieve data. If None will retrieve data from all available trials.

  • use_model_predictions (bool) – Whether to extract the Pareto frontier using model predictions or directly observed values. If True, the metric means and covariances in this method’s output will also be based on model predictions and may differ from the observed values.

Returns

None if it was not possible to extract the best trial or best Pareto frontier, otherwise 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).

Return type

dict

best_raw_trials(optimization_config: Optional[OptimizationConfig] = None, trial_indices: Optional[Iterable[int]] = None, use_model_predictions: bool = False, *args, **kwargs) dict[source]#

Identifies the best parameterizations tried in the experiment so far using the raw points themselves.

If it is a Multi Objective Problem, then it will return the pareto front, a collection of trials that are the best front that min/maxes the objectives. Else it is the best point that min/maxes the objective.

NOTE: The format of this method’s output is as follows: { trial_index: {params: best parameters, means: dict of metrics by nam, cov_matrix: dict of cov matrix} },

Parameters
  • optimization_config (Optional[OptimizationConfig]) – Optimization config to use in place of the one stored on the experiment.

  • trial_indices (Optional[Iterable[int]]) – Indices of trials for which to retrieve data. If None will retrieve data from all available trials.

  • use_model_predictions (bool) – Whether to extract the Pareto frontier using model predictions or directly observed values. If True, the metric means and covariances in this method’s output will also be based on model predictions and may differ from the observed values.

Returns

None if it was not possible to extract the best trial or best Pareto frontier, otherwise 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).

Return type

dict

save_data(**kwargs)[source]#

Save Scheduler to json file. Defaults to wrapper.experiment_dir / filepath