|
Brush C++ API
A flexible interpretable machine learning framework
|
A virtual class representing a bandit operator. More...
#include <bandit_operator.h>


Public Member Functions | |
| BanditOperator (vector< string > arms) | |
| Constructs a BanditOperator object with a vector of arms. | |
| BanditOperator (map< string, float > arms_probs) | |
| Constructs a BanditOperator object with a map of arms and their probabilities. | |
| ~BanditOperator () | |
| virtual std::map< string, float > | sample_probs (bool update) |
| Samples the probabilities of the arms. | |
| virtual string | choose () |
| Chooses an arm based on the given tree and fitness. Should call sample_probs internally. | |
| virtual void | update (string arm, float reward) |
| Updates the reward for a specific arm. | |
Protected Attributes | |
| std::map< string, float > | probabilities |
Private Types | |
| using | Iter = tree<Node>::pre_order_iterator |
A virtual class representing a bandit operator.
This class provides functionality for sampling probabilities and updating rewards for different arms. The bandit should somehow behave stocasticaly when called twice in a row without being rewarded, because some mutations may require multiple sampling from the search space. Also, the bandit should have a functionality to return smapling probabilities, instead of just the chosen arm.
| T | The type of the arms. |
Definition at line 21 of file bandit_operator.h.
|
private |
Definition at line 23 of file bandit_operator.h.
Constructs a BanditOperator object with a vector of arms.
| arms | The vector of arms. |
Definition at line 6 of file bandit_operator.cpp.

Constructs a BanditOperator object with a map of arms and their probabilities.
| arms_probs | The map of arms and their probabilities. |
Definition at line 17 of file bandit_operator.cpp.
|
inline |
Definition at line 39 of file bandit_operator.h.
|
virtual |
Chooses an arm based on the given tree and fitness. Should call sample_probs internally.
| tree | The tree structure used to choose the arm. |
| f | The fitness value used to influence the choice. |
Reimplemented in Brush::MAB::DummyBandit, and Brush::MAB::ThompsonSamplingBandit.
Definition at line 37 of file bandit_operator.cpp.
|
virtual |
Samples the probabilities of the arms.
| update | A boolean indicating whether to update the probabilities. |
Reimplemented in Brush::MAB::DummyBandit, and Brush::MAB::ThompsonSamplingBandit.
Definition at line 25 of file bandit_operator.cpp.

|
virtual |
Updates the reward for a specific arm.
| arm | The arm for which to update the reward. |
| reward | The reward value. |
Reimplemented in Brush::MAB::DummyBandit, and Brush::MAB::ThompsonSamplingBandit.
Definition at line 49 of file bandit_operator.cpp.

|
protected |
Definition at line 66 of file bandit_operator.h.