# 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]).

__init__(p, trunc=1)[source]

New arm.

p = None

Parameter p for Exponential arm

trunc = None

Max value of reward

mean = None

Mean of Exponential arm

draw(t=None)[source]

Draw one random sample. The parameter t is ignored in this Arm.

draw_nparray(shape=(1, ))[source]

Draw one random sample. The parameter t is ignored in this Arm.

set_mean_param(p_inv)[source]
property lower_amplitude

(lower, amplitude)

__str__()[source]

Return str(self).

__repr__()[source]

Return repr(self).

static kl(x, y)[source]

The kl(x, y) to use for this arm.

static oneLR(mumax, mu)[source]

One term of the Lai & Robbins lower bound for Exponential arms: (mumax - mu) / KL(mu, mumax).

oneHOI(mumax, mu)[source]

One term for the HOI factor for this arm.

__module__ = 'Arms.Exponential'
class Arms.Exponential.ExponentialFromMean(mean, trunc=1)[source]

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]).

__init__(mean, trunc=1)[source]

New arm.

__module__ = 'Arms.Exponential'
class Arms.Exponential.UnboundedExponential(mu)[source]

Exponential distributed arm, not truncated, ie. trunc = oo.

__init__(mu)[source]

New arm.

__module__ = 'Arms.Exponential'