Arms.Exponential module¶
Exponentially distributed arm.
Example of creating an arm:
>>> import random; import numpy as np
>>> random.seed(0); np.random.seed(0)
>>> Exp03 = ExponentialFromMean(0.3)
>>> Exp03
\mathrm{Exp}(3.2, 1)
>>> Exp03.mean
0.3000...
Examples of sampling from an arm:
>>> Exp03.draw()
0.052...
>>> Exp03.draw_nparray(20)
array([0.18..., 0.10..., 0.15..., 0.18..., 0.26...,
0.13..., 0.25..., 0.03..., 0.01..., 0.29... ,
0.07..., 0.19..., 0.17..., 0.02... , 0.82... ,
0.76..., 1. , 0.05..., 0.07..., 0.04...])
-
class
Arms.Exponential.
Exponential
(p, trunc=1)[source]¶ Bases:
Arms.Arm.Arm
Exponentially distributed arm, possibly truncated.
Default is to truncate to 1 (so Exponential.draw() is in [0, 1]).
-
p
= None¶ Parameter p for Exponential arm
-
trunc
= None¶ Max value of reward
-
mean
= None¶ Mean of Exponential arm
-
property
lower_amplitude
¶ (lower, amplitude)
-
static
oneLR
(mumax, mu)[source]¶ One term of the Lai & Robbins lower bound for Exponential arms: (mumax - mu) / KL(mu, mumax).
-
__module__
= 'Arms.Exponential'¶
-
class
Arms.Exponential.
ExponentialFromMean
(mean, trunc=1)[source]¶ Bases:
Arms.Exponential.Exponential
Exponentially distributed arm, possibly truncated, defined by its mean and not its parameter.
Default is to truncate to 1 (so Exponential.draw() is in [0, 1]).
-
__module__
= 'Arms.Exponential'¶