mlos_core.spaces.adapters.llamatune
===================================

.. py:module:: mlos_core.spaces.adapters.llamatune

.. autoapi-nested-parse::

   Implementation of LlamaTune space adapter.

   LlamaTune is a technique that transforms the original parameter space into a
   lower-dimensional space to try and improve the sample efficiency of the underlying
   optimizer by making use of the inherent parameter sensitivity correlations in most
   systems.

   See Also: `LlamaTune: Sample-Efficient DBMS Configuration Tuning
   <https://www.microsoft.com/en-us/research/publication/llamatune-sample-efficient-dbms-configuration-tuning>`_.



Classes
-------

.. autoapisummary::

   mlos_core.spaces.adapters.llamatune.LlamaTuneAdapter


Module Contents
---------------

.. py:class:: LlamaTuneAdapter(*, orig_parameter_space: ConfigSpace.ConfigurationSpace, num_low_dims: int = DEFAULT_NUM_LOW_DIMS, special_param_values: dict | None = None, max_unique_values_per_param: int | None = DEFAULT_MAX_UNIQUE_VALUES_PER_PARAM, use_approximate_reverse_mapping: bool = False)

   Bases: :py:obj:`mlos_core.spaces.adapters.adapter.BaseSpaceAdapter`


   Implementation of LlamaTune, a set of parameter space transformation techniques,
   aimed at improving the sample-efficiency of the underlying optimizer.

   Create a space adapter that employs LlamaTune's techniques.

   :param orig_parameter_space: The original (user-provided) parameter space to optimize.
   :type orig_parameter_space: ConfigSpace.ConfigurationSpace
   :param num_low_dims: Number of dimensions used in the low-dimensional parameter search space.
   :type num_low_dims: int
   :param special_param_values: Dictionary of special parameter values.
                                Each key is the name of a parameter, and the value is either:
                                - an integer (special value), or
                                - a tuple of an integer and a float (special integer value and biasing percentage)
   :type special_param_values: dict | None
   :param max_unique_values_per_param: Number of unique values per parameter. Used to discretize the parameter space.
                                       If `None` space discretization is disabled.
   :type max_unique_values_per_param: int | None
   :param use_approximate_reverse_mapping: Whether to use an approximate reverse mapping to help register
                                           configurations during resume.
   :type use_approximate_reverse_mapping: bool


   .. py:method:: inverse_transform(configuration: pandas.Series) -> pandas.Series

      Translates a configuration, which belongs to the original parameter space, to
      the target parameter space. This method is called by the `register` method of
      the :py:class:`~mlos_core.optimizers.optimizer.BaseOptimizer` class, and
      performs the inverse operation of :py:meth:`~.BaseSpaceAdapter.transform`
      method.

      :param configuration: A Series of configuration parameters, which belong to the original parameter space.
                            The indices are the parameter names the original parameter space and the
                            rows are the configurations.
      :type configuration: pandas.Series

      :returns: **configuration** -- Series of the translated configurations / parameters.
                The indices are the parameter names of the target parameter space and
                the rows are the configurations.
      :rtype: pandas.Series



   .. py:method:: transform(configuration: pandas.Series) -> pandas.Series

      Translates a configuration, which belongs to the target parameter space, to the
      original parameter space. This method is called by the
      :py:meth:`~mlos_core.optimizers.optimizer.BaseOptimizer.suggest` method of the
      :py:class:`~mlos_core.optimizers.optimizer.BaseOptimizer` class.

      :param configuration: Pandas series. Column names are the parameter names
                            of the target parameter space.
      :type configuration: pandas.Series

      :returns: **configuration** -- Pandas series, containing the translated configuration.
                Column names are the parameter names of the original parameter space.
      :rtype: pandas.Series



   .. py:attribute:: DEFAULT_MAX_UNIQUE_VALUES_PER_PARAM
      :value: 10000


      Default number of (max) unique values of each parameter, when space
      discretization is used.


   .. py:attribute:: DEFAULT_NUM_LOW_DIMS
      :value: 16


      Default number of dimensions in the low-dimensional search space, generated by
      HeSBO projection.


   .. py:attribute:: DEFAULT_SPECIAL_PARAM_VALUE_BIASING_PERCENTAGE
      :value: 0.2


      Default percentage of bias for each special parameter value.


   .. py:property:: target_parameter_space
      :type: ConfigSpace.ConfigurationSpace


      Get the parameter space, which is explored by the underlying optimizer.