The arms submodule¶
Contents:
-
class
multibeep.arms.base¶ Bases:
object-
get_ident(self)¶ access to the possibly non-unique name of an arm
Returns: string – name of the arm
-
posterior(self)¶ access to the arm’s posterior
Returns: posterior_class – a (valid) posterior
-
provides_posterior(self)¶ to query if an arm provides a posterior
Returns: bool – True if the arm has a posterior, False if not
-
pull(self)¶ pulls the arm
Returns: float – recieved reward
-
real_mean(self)¶ the mean of the underlying distribution
Returns: float – mean of the underlying distribution, NaN if N/A
-
real_variance(self)¶ the variance of the underlying distribution
Returns: float – variance of the underlying distribution, NaN if N/A
-
-
class
multibeep.arms.bernoulli(float_t p, rng_class rng)¶ Bases:
multibeep.arms.baseThe classic Bernoulli arm.
Provides the ‘default’ posterior using a Beta prior.
Parameters: - p (float) – the p parameter of the Bernoulli distribution
- rng (multibeep.util.rng_class) – a random number generator object
-
class
multibeep.arms.data(ndarray data, name, rng_class rng, bootstrap=False)¶ Bases:
multibeep.arms.baseParameters: - data (numpy.ndarray (1d)) – The data for this arme. The data is copied at least once, but if the data is not in C order, a second temporary copy is made.
- name (string) – the name associated with this arm
- rng (multibeep.util.rng_class) – a random number generator object
- bootstrap (bool) –
If false, the rewards are returned in sequential order starting with the first when the end is reached.
If true, an entry is chosen uniformly at random (with replacement)
Default is False.
-
class
multibeep.arms.exponential(float_t l, rng_class rng)¶ Bases:
multibeep.arms.baseAn arm with the exponential reward distribution.
Provides a posterior using an inverse-Gamma prior.
Parameters: - l (float) – the lambda parameter of the exponential distribution
- rng (multibeep.util.rng_class) – a random number generator object
-
class
multibeep.arms.normal(float_t mean, float_t variance, rng_class rng)¶ Bases:
multibeep.arms.baseAn arm with a normal reward distribution
Provides a Bayesian posterior where the mean and variance are unknown!
Parameters: - mean (float) – the mean of the normal distribution
- variance (float) – the variance of the normal distribution
- rng (multibeep.util.rng_class) – a random number generator object