k-Armed Bandit 1.0.0
A collection of k-armed bandits and assoicated agents for reinforcement learning
|
This class implements a bandit with a constant reward value each time an arm is chosen. More...
Public Member Functions | |
__init__ (self, k, rewards=None) | |
Instantiate the class. | |
rewards (self) | |
select (self, index) | |
Get a reward from the chosen arm. | |
trueValues (self) | |
Provide a numpy array of the rewards for each arm. | |
Public Member Functions inherited from bandit.base_bandit.BaseBandit | |
int | k (self) |
Return the number of arms this bandit has. | |
Public Attributes | |
k | |
Protected Attributes | |
_rewards | |
Protected Attributes inherited from bandit.base_bandit.BaseBandit | |
_k | |
This class implements a bandit with a constant reward value each time an arm is chosen.
The reward is not drawn from a distribution, nor does it change over time. The user can specify the reward values at instantiation if they want.
bandit.static.Static.__init__ | ( | self, | |
k, | |||
rewards = None |
|||
) |
Instantiate the class.
If reward_values is provided, it will be used for the reward values. Otherwise, a random value on the interval [0, 1) will be chosen for each arm.
k | An int greater than or equal to one representing the number of arms this bandit has. |
rewards | If provided, the fixed reward for each arm. It can be a list, array, numpy array, or any sort of iterable object, but must have a length equal to k. It can also be None to let the bandit pick random rewards from the interval [0, 1). |
Reimplemented from bandit.base_bandit.BaseBandit.
bandit.static.Static.select | ( | self, | |
index | |||
) |
Get a reward from the chosen arm.
index | The arm to pick. It can be any input that allows for indexing of a numpy array, including single integers or a set of integers. |
Reimplemented from bandit.base_bandit.BaseBandit.
bandit.static.Static.trueValues | ( | self | ) |
Provide a numpy array of the rewards for each arm.
Reimplemented from bandit.base_bandit.BaseBandit.