boax.experiments.bandit

Contents

boax.experiments.bandit#

boax.experiments.bandit(parameters, *, seed=0, policy=None, belief=None)#

Setup for a multi-arm bandit optimization experiment.

Example

>>> experiment = bandit([{'name': 'arm', 'type': 'choice', 'values': ['left', 'middle', 'right']}])
Parameters:
  • parameters (list[dict[str, Any]]) – List of parameters describing the variants to be optimized. Each parameter is described by a dictionary with a ‘name’, a ‘type’ of choice, and ‘values’ of the variants for each parameter.

  • seed (int) – The initial random seed.

  • policy (Optional[Policy[TypeVar(T)]]) – The policy to be used for optimization.

  • belief (Optional[Belief[TypeVar(T), TypeVar(S)]]) – The belief to be used for optimization.

Return type:

Trial[TypeVar(T)]

Returns:

A trail object with next and best functions.

Raises:

ValueError – If given parameters cannot be parsed or don’t match requirements.