AIToolbox
A library that offers tools for AI problem solving.
TopTwoThompsonSamplingPolicy.hpp
Go to the documentation of this file.
1
#ifndef AI_TOOLBOX_BANDIT_TOP_TWO_THOMPSON_SAMPLING_POLICY_HEADER_FILE
2
#define AI_TOOLBOX_BANDIT_TOP_TWO_THOMPSON_SAMPLING_POLICY_HEADER_FILE
3
4
#include <
AIToolbox/Bandit/Types.hpp
>
5
#include <
AIToolbox/Bandit/Experience.hpp
>
6
#include <
AIToolbox/Bandit/Policies/PolicyInterface.hpp
>
7
#include <
AIToolbox/Bandit/Policies/ThompsonSamplingPolicy.hpp
>
8
9
namespace
AIToolbox::Bandit
{
34
class
TopTwoThompsonSamplingPolicy
:
public
PolicyInterface
{
35
public
:
42
TopTwoThompsonSamplingPolicy
(
const
Experience
& exp,
double
beta);
43
49
virtual
size_t
sampleAction
()
const override
;
50
56
size_t
recommendAction
()
const
;
57
71
virtual
double
getActionProbability
(
const
size_t
& a)
const override
;
72
85
virtual
Vector
getPolicy
()
const override
;
86
92
const
Experience
&
getExperience
()
const
;
93
94
private
:
95
ThompsonSamplingPolicy
policy_;
96
double
beta_;
97
};
98
}
99
100
#endif
AIToolbox::Bandit::TopTwoThompsonSamplingPolicy::getPolicy
virtual Vector getPolicy() const override
This function returns a vector containing all probabilities of the policy.
AIToolbox::Bandit::ThompsonSamplingPolicy
This class implements a Thompson sampling policy.
Definition:
ThompsonSamplingPolicy.hpp:19
Experience.hpp
AIToolbox::Bandit::PolicyInterface
Simple typedef for most of a normal Bandit's policy needs.
Definition:
PolicyInterface.hpp:11
AIToolbox::Bandit::TopTwoThompsonSamplingPolicy::getExperience
const Experience & getExperience() const
This function returns a reference to the underlying Experience we use.
AIToolbox::Vector
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
Definition:
Types.hpp:16
AIToolbox::Bandit::TopTwoThompsonSamplingPolicy
This class implements the top-two Thompson sampling policy.
Definition:
TopTwoThompsonSamplingPolicy.hpp:34
AIToolbox::Bandit::TopTwoThompsonSamplingPolicy::TopTwoThompsonSamplingPolicy
TopTwoThompsonSamplingPolicy(const Experience &exp, double beta)
Basic constructor.
AIToolbox::Bandit
Definition:
Experience.hpp:6
PolicyInterface.hpp
Types.hpp
AIToolbox::Bandit::Experience
This class computes averages and counts for a Bandit problem.
Definition:
Experience.hpp:13
AIToolbox::Bandit::TopTwoThompsonSamplingPolicy::sampleAction
virtual size_t sampleAction() const override
This function chooses an action using top-two Thompson sampling.
AIToolbox::Bandit::TopTwoThompsonSamplingPolicy::recommendAction
size_t recommendAction() const
This function returns the most likely best action until this point.
AIToolbox::Bandit::TopTwoThompsonSamplingPolicy::getActionProbability
virtual double getActionProbability(const size_t &a) const override
This function returns the probability of taking the specified action.
ThompsonSamplingPolicy.hpp