Arms.Bernoulli module¶
Bernoulli distributed arm.
Example of creating an arm:
>>> import random; import numpy as np
>>> random.seed(0); np.random.seed(0)
>>> B03 = Bernoulli(0.3)
>>> B03
B(0.3)
>>> B03.mean
0.3
Examples of sampling from an arm:
>>> B03.draw()
0
>>> B03.draw_nparray(20)
array([1., 0., 0., 0., 0., 0., 1., 1., 0., 1., 0., 0., 1., 0., 0., 0., 1.,
1., 1., 1.])
-
class
Arms.Bernoulli.
Bernoulli
(probability)[source]¶ Bases:
Arms.Arm.Arm
Bernoulli distributed arm.
-
probability
= None¶ Parameter p for this Bernoulli arm
-
mean
= None¶ Mean for this Bernoulli arm
-
property
lower_amplitude
¶ (lower, amplitude)
-
static
oneLR
(mumax, mu)[source]¶ One term of the Lai & Robbins lower bound for Bernoulli arms: (mumax - mu) / KL(mu, mumax).
-
__module__
= 'Arms.Bernoulli'¶
-