k-Armed Bandit 1.0.0
A collection of k-armed bandits and assoicated agents for reinforcement learning
|
A random walk bandit. More...
Public Member Functions | |
None | __init__ (self, int k) |
Construct the class. | |
select (self, index) | |
Select one or several arms to obtain a reward from. | |
Public Member Functions inherited from bandit.normal.Normal | |
trueValues (self) | |
Return the distribution parameters for the arms. | |
Public Member Functions inherited from bandit.base_bandit.BaseBandit | |
int | k (self) |
Return the number of arms this bandit has. | |
Additional Inherited Members | |
Protected Attributes inherited from bandit.normal.Normal | |
_std | |
_mean | |
Protected Attributes inherited from bandit.base_bandit.BaseBandit | |
_k | |
A random walk bandit.
This class features k arms with rewards from the arms drawn from normal distributions. The means, when initialized, are drawn from a uniform range of [-1, 1). However, after each call to select, the means for every arm is changed. Each arm's mean is adjusted by a randomly selected value drawn from a normal distribution with mean 0 and standard deviation 0.01. These values are drawn independently for each arm.
Definition at line 5 of file random_walk.py.
None bandit.random_walk.RandomWalk.__init__ | ( | self, | |
int | k | ||
) |
Construct the class.
This includes defining the normal distribution parameters for each arm. There is a different distribution for each arm. The means are sampled from the uniform range [-1, 1). The standard deviations are 1.0.
k | The number of arms this bandit should have. This must be an int greater than 0. |
Reimplemented from bandit.normal.Normal.
Definition at line 17 of file random_walk.py.
bandit.random_walk.RandomWalk.select | ( | self, | |
index | |||
) |
Select one or several arms to obtain a reward from.
index | Any numpy valid indexing method to select which arms a reward should be drawn from. None can also be passed, but will only return a reward of None. |
Reimplemented from bandit.normal.Normal.
Definition at line 20 of file random_walk.py.