Arms.Constant module¶
Arm with a constant reward. Useful for debugging.
Example of creating an arm:
>>> C013 = Constant(0.13)
>>> C013
Constant(0.13)
>>> C013.mean
0.13
Examples of sampling from an arm:
>>> C013.draw()
0.13
>>> C013.draw_nparray(3)
array([0.13, 0.13, 0.13])
-
class
Arms.Constant.
Constant
(constant_reward=0.5, lower=0.0, amplitude=1.0)[source]¶ Bases:
Arms.Arm.Arm
Arm with a constant reward. Useful for debugging.
constant_reward is the constant reward,
lower, amplitude default to floor(constant_reward), 1 (so the )
>>> arm_0_5 = Constant(0.5) >>> arm_0_5.draw() 0.5 >>> arm_0_5.draw_nparray((3, 2)) array([[0.5, 0.5], [0.5, 0.5], [0.5, 0.5]])
-
constant_reward
= None¶ Constant value of rewards
-
lower
= None¶ Known lower value of rewards
-
amplitude
= None¶ Known amplitude of rewards
-
mean
= None¶ Mean for this Constant arm
-
static
oneLR
(mumax, mu)[source]¶ One term of the Lai & Robbins lower bound for Constant arms: (mumax - mu) / KL(mu, mumax).
-
__module__
= 'Arms.Constant'¶