k-Armed Bandit 1.0.0
A collection of k-armed bandits and assoicated agents for reinforcement learning
|
A base class for the various bandit implementations. More...
Public Member Functions | |
None | __init__ (self, int k) |
Initialize the object with a set number of arms. | |
int | k (self) |
Return the number of arms this bandit has. | |
select (self, index) | |
The method to select one of the arms of the bandit. | |
trueValues (self) | |
Return the true reward values of the bandit. | |
Protected Attributes | |
_k | |
A base class for the various bandit implementations.
This class defines several abstract methods and properties that must be implemented by any k-armed bandit implementation. This ensures consistent APIs across all of them.
Definition at line 4 of file base_bandit.py.
None bandit.base_bandit.BaseBandit.__init__ | ( | self, | |
int | k | ||
) |
Initialize the object with a set number of arms.
k | The number of arms this bandit should have. This must be an integer greater than zero. |
ValueError | if k is not an integer greater than zero. |
Reimplemented in bandit.normal.Normal, bandit.random_walk.RandomWalk, bandit.tests.test_base_bandit.FakeBandit, and bandit.static.Static.
Definition at line 13 of file base_bandit.py.
int bandit.base_bandit.BaseBandit.k | ( | self | ) |
Return the number of arms this bandit has.
Definition at line 26 of file base_bandit.py.
bandit.base_bandit.BaseBandit.select | ( | self, | |
index | |||
) |
The method to select one of the arms of the bandit.
When implemented, this method should return the reward obtained when selecting the given arm index.
index | Some sort of index representation to select which arms to get rewards from. Typically, this will be a single integer or some sort of list, array, etc. of integers. |
Reimplemented in bandit.normal.Normal, bandit.random_walk.RandomWalk, bandit.static.Static, and bandit.tests.test_base_bandit.FakeBandit.
Definition at line 34 of file base_bandit.py.
bandit.base_bandit.BaseBandit.trueValues | ( | self | ) |
Return the true reward values of the bandit.
When implemented, this should provide the user with the complete truth of the bandit's state at the moment called. It is up to the implementation what exact information this is.
Reimplemented in bandit.normal.Normal, bandit.static.Static, and bandit.tests.test_base_bandit.FakeBandit.
Definition at line 47 of file base_bandit.py.
|
protected |
Definition at line 23 of file base_bandit.py.