Brush C++ API
A flexible interpretable machine learning framework
Loading...
Searching...
No Matches
bandit_operator.h
Go to the documentation of this file.
1#ifndef BANDIT_OPERATOR_H
2#define BANDIT_OPERATOR_H
3
4#include "../init.h"
5// #include "../data/data.h"
6#include "../types.h"
7#include "../params.h"
9#include "../ind/fitness.h"
10
11namespace Brush {
12namespace MAB {
13
21template<typename T>
23{
24 using Iter = tree<Node>::pre_order_iterator;
25public:
31 BanditOperator(vector<T> arms);
32
38 BanditOperator(map<T, float> arms_probs);
39
41
48 virtual std::map<T, float> sample_probs(bool update);
49
57 virtual T choose(const VectorXf& context);
58
65 virtual void update(T arm, float reward, VectorXf& context);
66protected:
67 std::map<T, float> probabilities;
68};
69
70} // MAB
71} // Brush
72
73#endif // BANDIT_OPERATOR_H
virtual std::map< T, float > sample_probs(bool update)
Samples the probabilities of the arms.
virtual T choose(const VectorXf &context)
Chooses an arm based on the given tree and fitness. Should call sample_probs internally.
tree< Node >::pre_order_iterator Iter
BanditOperator(vector< T > arms)
Constructs a BanditOperator object with a vector of arms.
std::map< T, float > probabilities
virtual void update(T arm, float reward, VectorXf &context)
Updates the reward for a specific arm.
< nsga2 selection operator for getting the front
Definition bandit.cpp:4