|
Brush C++ API
A flexible interpretable machine learning framework
|
The Bandit struct represents a multi-armed bandit. More...
#include <bandit.h>

Public Types | |
| using | Iter = tree<Node>::pre_order_iterator |
Public Member Functions | |
| Bandit () | |
| ~Bandit () | |
| Bandit (string type, vector< string > arms) | |
| Constructor for the Bandit struct. | |
| Bandit (string type, map< string, float > arms_probs) | |
| Constructor for the Bandit struct. | |
| void | set_bandit () |
| Sets the bandit operator (policy). | |
| void | set_arms (vector< string > arms) |
| Sets the arms of the bandit. | |
| vector< string > | get_arms () |
| Gets the arms of the bandit. | |
| string | get_type () |
| Gets the type of the bandit. | |
| void | set_type (string type) |
| Sets the type of the bandit. | |
| map< string, float > | get_probs () |
| Gets the probabilities associated with each arm. | |
| void | set_probs (map< string, float > arms_probs) |
| Sets the probabilities associated with each arm. | |
| map< string, float > | sample_probs (bool update=false) |
| Samples the probabilities associated with each arm using the policy. | |
| string | choose () |
| Selects an arm. | |
| void | update (string arm, float reward) |
| Updates the bandit's state based on the chosen arm and the received reward. | |
Public Attributes | |
| std::shared_ptr< BanditOperator > | pbandit |
| A shared pointer to the bandit operator (policy). | |
| std::string | type |
| vector< string > | arms |
| std::map< string, float > | probabilities |
The Bandit struct represents a multi-armed bandit.
The Bandit struct encapsulates the bandit operator (policy) and provides\ methods to set and get the arms, type, and probabilities of the bandit. It also provides a method to update the bandit's state based on the chosen arm and the received reward.
| using Brush::MAB::Bandit::Iter = tree<Node>::pre_order_iterator |
| Brush::MAB::Bandit::Bandit | ( | ) |
Constructor for the Bandit struct.
| type | The type of the bandit. |
| arms | The arms of the bandit. |
Definition at line 14 of file bandit.cpp.

Constructor for the Bandit struct.
| type | The type of the bandit. |
| arms_probs | The arms and their associated probabilities. |
Definition at line 26 of file bandit.cpp.

| string Brush::MAB::Bandit::choose | ( | ) |
Gets the arms of the bandit.
Definition at line 59 of file bandit.cpp.
Gets the probabilities associated with each arm.
Definition at line 67 of file bandit.cpp.
| string Brush::MAB::Bandit::get_type | ( | ) |
Gets the type of the bandit.
Definition at line 51 of file bandit.cpp.
Samples the probabilities associated with each arm using the policy.
| update | Flag indicating whether to update the bandit's state, or just return the current probabilities. |
Definition at line 75 of file bandit.cpp.

Sets the arms of the bandit.
Definition at line 63 of file bandit.cpp.

| void Brush::MAB::Bandit::set_bandit | ( | ) |
Sets the bandit operator (policy).
Definition at line 37 of file bandit.cpp.

Sets the probabilities associated with each arm.
| arms_probs | The arms and their associated probabilities. |
Definition at line 71 of file bandit.cpp.

| void Brush::MAB::Bandit::set_type | ( | string | type | ) |
Sets the type of the bandit.
Definition at line 55 of file bandit.cpp.

| void Brush::MAB::Bandit::update | ( | string | arm, |
| float | reward ) |
Updates the bandit's state based on the chosen arm and the received reward.
| arm | The chosen arm. |
| reward | The received reward. |
Definition at line 94 of file bandit.cpp.

| std::shared_ptr<BanditOperator> Brush::MAB::Bandit::pbandit |
| std::map<string, float> Brush::MAB::Bandit::probabilities |
| std::string Brush::MAB::Bandit::type |