.. _confgurable-parameters: Configurable parameters ----------------------------------------------- The *tuning* module can convert any parameter of any Python function into a *configurable* one. To achieve that, the user just has to: - Add the decorator ``@ac`` to the function containing the parameter - Annotate the configurable parameters with a custom *type hint* that specifies the parameter type, domain and default value. Consider the following Python function: .. code:: python :number-lines: def func1(data, p1 = True, p2 = 0.0, p3 = 0, p4 = "A"): ... This function receives *data* which will not be a configurable parameter and *p1*, *p2*, *p3* and *p4* that we want to turn into configurable parameters. The only changes that the user has to apply are the following: .. code:: python :number-lines: from optilog.tuning import ac, Bool, Int, Real, Categorical @ac def func1( data, p1: Bool() = True, p2: Real(-1.3, 2) = 0, p3: Int(-5, 5) = 0, p4: Categorical("A", "B", "C") = "A"): ... - The function must be decorated with the ``@ac`` decorator - All the configurable parameters must be annotated using *autocgf* custom type hints Notice that this annotated function can be used in the same contexts where the original function was used. The list of available *tuning* parameter types is the following: .. py:module:: optilog.tuning :noindex: .. autoclass:: optilog.tuning.Bool .. autoclass:: optilog.tuning.Int .. autoclass:: optilog.tuning.Real .. autoclass:: optilog.tuning.Categorical .. autoclass:: optilog.tuning.Choice .. autoclass:: optilog.tuning.Dict .. autoclass:: optilog.tuning.CfgCall .. autoclass:: optilog.tuning.CfgCls .. autoclass:: optilog.tuning.CfgObj