Arms.Poisson module¶
Poisson distributed arm, possibly truncated.
Example of creating an arm:
>>> import random; import numpy as np
>>> random.seed(0); np.random.seed(0)
>>> Poisson5 = Poisson(5, trunc=10)
>>> Poisson5
P(5, 10)
>>> Poisson5.mean
4.9778...
Examples of sampling from an arm:
>>> Poisson5.draw()
9
>>> Poisson5.draw_nparray(20)
array([ 5, 6, 5, 5, 8, 4, 5, 4, 3, 3, 7, 3, 3, 4, 5, 2, 1,
7, 7, 10])
-
class
Arms.Poisson.
Poisson
(p, trunc=1)[source]¶ Bases:
Arms.Arm.Arm
Poisson distributed arm, possibly truncated.
Default is to not truncate.
Warning: the draw() method is QUITE inefficient! (15 seconds for 200000 draws, 62 µs for 1).
-
p
= None¶ Parameter p for Poisson arm
-
trunc
= None¶ Max value of rewards
-
mean
= None¶ Mean for this Poisson arm
-
static
oneLR
(mumax, mu)[source]¶ One term of the Lai & Robbins lower bound for Poisson arms: (mumax - mu) / KL(mu, mumax).
-
__module__
= 'Arms.Poisson'¶