mlos_core.spaces.adapters

Basic initializer module for the mlos_core space adapters.

Space adapters provide a mechanism for automatic transformation of the original ConfigSpace.ConfigurationSpace provided to the optimizer into a new space that is more suitable for the optimizer.

By default the IdentityAdapter is used, which does not perform any transformation. But, for instance, the LlamaTuneAdapter can be used to automatically transform the space to a lower dimensional one.

See the mlos_bench.optimizers.mlos_core_optimizer module for more information on how to do this with mlos_bench.

This module provides a simple SpaceAdapterFactory class to create() space adapters.

Examples

TODO: Add example usage here.

Notes

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

Submodules

Attributes

ConcreteSpaceAdapter

Type variable for concrete SpaceAdapter classes (e.g.,

Classes

SpaceAdapterFactory

Simple factory class for creating

SpaceAdapterType

Enumerate supported mlos_core space adapters.

Package Contents

class mlos_core.spaces.adapters.SpaceAdapterFactory[source]

Simple factory class for creating BaseSpaceAdapter-derived objects.

static create(*, parameter_space: ConfigSpace.ConfigurationSpace, space_adapter_type: SpaceAdapterType = SpaceAdapterType.IDENTITY, space_adapter_kwargs: dict | None = None) ConcreteSpaceAdapter[source]

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

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

  • 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:

space_adapter – Instance of concrete space adapter (e.g., None, LlamaTuneAdapter, etc.)

Return type:

ConcreteSpaceAdapter

class mlos_core.spaces.adapters.SpaceAdapterType(*args, **kwds)[source]

Bases: enum.Enum

Enumerate supported mlos_core space adapters.

IDENTITY[source]

A no-op adapter (IdentityAdapter) will be used.

LLAMATUNE[source]

An instance of LlamaTuneAdapter class will be used.

mlos_core.spaces.adapters.ConcreteSpaceAdapter[source]

Type variable for concrete SpaceAdapter classes (e.g., IdentityAdapter, etc.)