mlos_core.optimizers

Initializer module for the mlos_core optimizers.

Optimizers are the main component of the mlos_core package. They act as a wrapper around other OSS tuning libraries to provide a consistent API interface to allow experimenting with different autotuning algorithms.

The BaseOptimizer class is the base class for all Optimizers and provides the core suggest() and register() methods.

This module also provides a simple OptimizerFactory class to create() an Optimizer.

Examples

TODO: Add example usage here.

Notes

See mlos_core/optimizers/README.md for additional documentation and examples in the source tree.

Submodules

Attributes

ConcreteOptimizer

Type variable for concrete optimizer classes.

Classes

OptimizerFactory

Simple factory class for creating

OptimizerType

Enumerate supported mlos_core optimizers.

Package Contents

class mlos_core.optimizers.OptimizerFactory[source]

Simple factory class for creating BaseOptimizer-derived objects.

static create(*, parameter_space: ConfigSpace.ConfigurationSpace, optimization_targets: List[str], optimizer_type: OptimizerType = DEFAULT_OPTIMIZER_TYPE, optimizer_kwargs: dict | None = None, space_adapter_type: mlos_core.spaces.adapters.SpaceAdapterType = SpaceAdapterType.IDENTITY, space_adapter_kwargs: dict | None = None) ConcreteOptimizer[source]

Create a new optimizer instance, given the parameter space, optimizer type, and potential optimizer options.

Parameters:
  • parameter_space (ConfigSpace.ConfigurationSpace) – Input configuration space.

  • optimization_targets (List[str]) – The names of the optimization targets to minimize.

  • optimizer_type (OptimizerType) – Optimizer class as defined by Enum.

  • optimizer_kwargs (Optional[dict]) – Optional arguments passed in Optimizer class constructor.

  • space_adapter_type (Optional[SpaceAdapterType]) – Space adapter class to be used alongside the optimizer.

  • space_adapter_kwargs (Optional[dict]) – Optional arguments passed in SpaceAdapter class constructor.

Returns:

optimizer – Instance of concrete optimizer class (e.g., RandomOptimizer, FlamlOptimizer, SmacOptimizer, etc.).

Return type:

ConcreteOptimizer

class mlos_core.optimizers.OptimizerType(*args, **kwds)[source]

Bases: enum.Enum

Enumerate supported mlos_core optimizers.

FLAML[source]

An instance of FlamlOptimizer class will be used.

RANDOM[source]

An instance of RandomOptimizer class will be used.

SMAC[source]

An instance of SmacOptimizer class will be used.

mlos_core.optimizers.ConcreteOptimizer[source]

Type variable for concrete optimizer classes.

(e.g., SmacOptimizer, etc.)