mlos_core.optimizers.random_optimizer

RandomOptimizer class.

Classes

RandomOptimizer

Optimizer class that produces random suggestions.

Module Contents

class mlos_core.optimizers.random_optimizer.RandomOptimizer(*, parameter_space: ConfigSpace.ConfigurationSpace, optimization_targets: List[str], objective_weights: List[float] | None = None, space_adapter: mlos_core.spaces.adapters.adapter.BaseSpaceAdapter | None = None)[source]

Bases: mlos_core.optimizers.optimizer.BaseOptimizer

Optimizer class that produces random suggestions.

Useful for baseline comparison against Bayesian optimizers.

Create a new instance of the base optimizer.

Parameters:
  • parameter_space (ConfigSpace.ConfigurationSpace) – The parameter space to optimize.

  • optimization_targets (List[str]) – The names of the optimization targets to minimize. To maximize a target, use the negative of the target when registering scores.

  • objective_weights (Optional[List[float]]) – Optional list of weights of optimization targets.

  • space_adapter (BaseSpaceAdapter) – The space adapter class to employ for parameter space transformations.

abstract register_pending(*, configs: pandas.DataFrame, context: pandas.DataFrame | None = None, metadata: pandas.DataFrame | None = None) None[source]

Registers the given configs as “pending”. That is it say, it has been suggested by the optimizer, and an experiment trial has been started. This can be useful for executing multiple trials in parallel, retry logic, etc.

Parameters:
  • configs (pandas.DataFrame) – Dataframe of configs / parameters. The columns are parameter names and the rows are the configs.

  • context (pandas.DataFrame) – Not Yet Implemented.

  • metadata (Optional[pandas.DataFrame]) – Metadata returned by the backend optimizer’s suggest method.

Return type:

None