std1.0.0-beta-7 SafeC docs

std :: ml::rl

Struct std::Dqn

#include <std/ml/rl.h> source

struct Dqn {
    struct Mlp q;
    struct Mlp target;
    struct Optimizer opt;
    struct ReplayBuffer buffer;
    struct DqnConfig cfg;
    struct Rng rng;
    struct TensorArena stepArena;
    unsigned long obsDim;
    unsigned long actions;
    unsigned long steps;
    unsigned long updates;
    float lastLoss;
}

Fields

§struct Mlp qsource
§struct Mlp targetsource
§struct ReplayBuffer buffersource
§struct Rng rngsource
§struct TensorArena stepArenasource
§unsigned long obsDimsource
§unsigned long actionssource
§unsigned long stepssource

environment steps observed

§unsigned long updatessource

gradient steps taken

§float lastLosssource

Methods

§float epsilon() constsource · definition
§unsigned long act(const &FloatTensor obs, int explore)source · definition

explore 1: epsilon-greedy with the current epsilon; 0: greedy.

§float observe( const &FloatTensor obs, unsigned long action, float reward, const &FloatTensor next, int terminal, )source · definition

Stores the transition and trains when due; returns the loss, or -1 when no gradient step ran.

§void collect_params(&Vec<&FloatTensor> out) constsource · definition

Parameterized (module.h): the Q network's parameters; the state adds the target network.

§void collect_state(&Vec<&FloatTensor> out) constsource · definition
§void drop()source · definition
§void free() consumesource · definition

= drop()

§static struct Dqn new(unsigned long obsDim, unsigned long actions, const &DqnConfig cfg)source · definition