Brush C++ API
A flexible interpretable machine learning framework
|
#include <thompson.h>
Public Member Functions | |
ThompsonSamplingBandit (vector< T > arms, bool dynamic=false) | |
ThompsonSamplingBandit (map< T, float > arms_probs, bool dynamic=false) | |
~ThompsonSamplingBandit () | |
std::map< T, float > | sample_probs (bool update) |
Samples the probabilities of the arms. | |
T | choose (const VectorXf &context) |
Chooses an arm based on the given tree and fitness. Should call sample_probs internally. | |
void | update (T arm, float reward, VectorXf &context) |
Updates the reward for a specific arm. | |
![]() | |
BanditOperator (vector< T > arms) | |
Constructs a BanditOperator object with a vector of arms. | |
BanditOperator (map< T, float > arms_probs) | |
Constructs a BanditOperator object with a map of arms and their probabilities. | |
~BanditOperator () | |
Private Attributes | |
bool | dynamic_update |
float | C = 250 |
std::map< T, float > | alphas |
std::map< T, float > | betas |
Additional Inherited Members | |
![]() | |
std::map< T, float > | probabilities |
Definition at line 20 of file thompson.h.
Brush::MAB::ThompsonSamplingBandit< T >::ThompsonSamplingBandit | ( | vector< T > | arms, |
bool | dynamic = false ) |
Brush::MAB::ThompsonSamplingBandit< T >::ThompsonSamplingBandit | ( | map< T, float > | arms_probs, |
bool | dynamic = false ) |
|
inline |
Definition at line 25 of file thompson.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 from Brush::MAB::BanditOperator< T >.
Definition at line 81 of file thompson.cpp.
|
virtual |
Samples the probabilities of the arms.
update | A boolean indicating whether to update the probabilities. |
Reimplemented from Brush::MAB::BanditOperator< T >.
Definition at line 30 of file thompson.cpp.
|
virtual |
Updates the reward for a specific arm.
arm | The arm for which to update the reward. |
reward | The reward value. |
Reimplemented from Brush::MAB::BanditOperator< T >.
Definition at line 88 of file thompson.cpp.
|
private |
Definition at line 34 of file thompson.h.
|
private |
Definition at line 35 of file thompson.h.
|
private |
Definition at line 32 of file thompson.h.
|
private |
Definition at line 31 of file thompson.h.