TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
|
This sampler expects as input an unordered_map<string, Variant> containing an entry QKey, which is a tensor of size [b, n]. More...
#include <sampler.h>
Inherits cpid::BaseSampler.
Public Member Functions | |
EpsGreedySampler (double eps=0.07, const std::string &QKey=kQKey, const std::string &actionKey=kActionKey) | |
ag::Variant | sample (ag::Variant in) override |
Public Member Functions inherited from cpid::BaseSampler | |
BaseSampler () | |
virtual | ~BaseSampler ()=default |
virtual ag::Variant | computeProba (const ag::Variant &in, const ag::Variant &action) |
Public Attributes | |
double | eps_ |
std::string | QKey_ |
std::string | actionKey_ |
This sampler expects as input an unordered_map<string, Variant> containing an entry QKey, which is a tensor of size [b, n].
It outputs the same map, with a new key actionKey, which contains the best action with proba 1-eps, and a random action with proba eps.
cpid::EpsGreedySampler::EpsGreedySampler | ( | double | eps = 0.07 , |
const std::string & | QKey = kQKey , |
||
const std::string & | actionKey = kActionKey |
||
) |
|
overridevirtual |
Reimplemented from cpid::BaseSampler.
std::string cpid::EpsGreedySampler::actionKey_ |
double cpid::EpsGreedySampler::eps_ |
std::string cpid::EpsGreedySampler::QKey_ |