TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
Public Member Functions | Public Attributes | List of all members
cpid::EpsGreedySampler Class Reference

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_
 

Detailed Description

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.

Constructor & Destructor Documentation

cpid::EpsGreedySampler::EpsGreedySampler ( double  eps = 0.07,
const std::string &  QKey = kQKey,
const std::string &  actionKey = kActionKey 
)

Member Function Documentation

ag::Variant cpid::EpsGreedySampler::sample ( ag::Variant  in)
overridevirtual

Reimplemented from cpid::BaseSampler.

Member Data Documentation

std::string cpid::EpsGreedySampler::actionKey_
double cpid::EpsGreedySampler::eps_
std::string cpid::EpsGreedySampler::QKey_

The documentation for this class was generated from the following files: