Policies.BayesianIndexPolicy module

Basic Bayesian index policy. By default, it uses a Beta posterior.

class Policies.BayesianIndexPolicy.BayesianIndexPolicy(nbArms, posterior=<class 'Policies.Posterior.Beta.Beta'>, lower=0.0, amplitude=1.0, *args, **kwargs)[source]

Bases: Policies.IndexPolicy.IndexPolicy

Basic Bayesian index policy.

  • By default, it uses a Beta posterior (Policies.Posterior.Beta), one by arm.

  • Use *args and **kwargs if you want to give parameters to the underlying posteriors.

  • Or use params_for_each_posterior as a list of parameters (as a dictionary) to give a different set of parameters for each posterior.

__init__(nbArms, posterior=<class 'Policies.Posterior.Beta.Beta'>, lower=0.0, amplitude=1.0, *args, **kwargs)[source]

Create a new Bayesian policy, by creating a default posterior on each arm.

posterior = None

Posterior for each arm. List instead of dict, quicker access

__str__()[source]

-> str

startGame()[source]

Reset the posterior on each arm.

getReward(arm, reward)[source]

Update the posterior on each arm, with the normalized reward.

computeIndex(arm)[source]

Compute the current index of arm ‘arm’.

__module__ = 'Policies.BayesianIndexPolicy'