Brush C++ API
A flexible interpretable machine learning framework
Loading...
Searching...
No Matches
thompson.h
Go to the documentation of this file.
1#include "bandit_operator.h"
2
3#include "../util/utils.h" // to use random generator
4
5#ifndef THOMPSON_H
6#define THOMPSON_H
7
8namespace Brush {
9namespace MAB {
10
12{
13public:
14 ThompsonSamplingBandit(vector<string> arms, bool dynamic=false);
15 ThompsonSamplingBandit(map<string, float> arms_probs, bool dynamic=false);
17
18 std::map<string, float> sample_probs(bool update);
19 string choose();
20 void update(string arm, float reward);
21private:
23 float C = 250;
24
25 std::map<string, float> alphas;
26 std::map<string, float> betas;
27};
28
29} // MAB
30} // Brush
31
32#endif // THOMPSON_H
BanditOperator(vector< string > arms)
Constructs a BanditOperator object with a vector of arms.
string choose()
Chooses an arm based on the given tree and fitness. Should call sample_probs internally.
Definition thompson.cpp:54
std::map< string, float > sample_probs(bool update)
Samples the probabilities of the arms.
Definition thompson.cpp:27
void update(string arm, float reward)
Updates the reward for a specific arm.
Definition thompson.cpp:60
std::map< string, float > alphas
Definition thompson.h:25
ThompsonSamplingBandit(vector< string > arms, bool dynamic=false)
Definition thompson.cpp:6
std::map< string, float > betas
Definition thompson.h:26
< nsga2 selection operator for getting the front
Definition bandit.cpp:4