mlpack
Public Member Functions | List of all members
mlpack::rl::CategoricalDQN< OutputLayerType, InitType, NetworkType > Class Template Reference

Implementation of the Categorical Deep Q-Learning network. More...

#include <categorical_dqn.hpp>

Public Member Functions

 CategoricalDQN ()
 Default constructor.
 
 CategoricalDQN (const int inputDim, const int h1, const int h2, const int outputDim, TrainingConfig config, const bool isNoisy=false, InitType init=InitType(), OutputLayerType outputLayer=OutputLayerType())
 Construct an instance of CategoricalDQN class. More...
 
 CategoricalDQN (NetworkType &network, TrainingConfig config, const bool isNoisy=false)
 Construct an instance of CategoricalDQN class from a pre-constructed network. More...
 
void Predict (const arma::mat state, arma::mat &actionValue)
 Predict the responses to a given set of predictors. More...
 
void Forward (const arma::mat state, arma::mat &dist)
 Perform the forward pass of the states in real batch mode. More...
 
void ResetParameters ()
 Resets the parameters of the network.
 
void ResetNoise ()
 Resets noise of the network, if the network is of type noisy.
 
const arma::mat & Parameters () const
 Return the Parameters.
 
arma::mat & Parameters ()
 Modify the Parameters.
 
void Backward (const arma::mat state, arma::mat &lossGradients, arma::mat &gradient)
 Perform the backward pass of the state in real batch mode. More...
 

Detailed Description

template<typename OutputLayerType = EmptyLoss<>, typename InitType = GaussianInitialization, typename NetworkType = FFN<OutputLayerType, InitType>>
class mlpack::rl::CategoricalDQN< OutputLayerType, InitType, NetworkType >

Implementation of the Categorical Deep Q-Learning network.

For more information, see the following.

@misc{bellemare2017distributional,
author = {Marc G. Bellemare, Will Dabney, Rémi Munos},
title = {A Distributional Perspective on Reinforcement Learning},
year = {2017},
url = {http://arxiv.org/abs/1707.06887}
}
Template Parameters
OutputLayerTypeThe output layer type of the network.
InitTypeThe initialization type used for the network.
NetworkTypeThe type of network used for simple dqn.

Constructor & Destructor Documentation

◆ CategoricalDQN() [1/2]

template<typename OutputLayerType = EmptyLoss<>, typename InitType = GaussianInitialization, typename NetworkType = FFN<OutputLayerType, InitType>>
mlpack::rl::CategoricalDQN< OutputLayerType, InitType, NetworkType >::CategoricalDQN ( const int  inputDim,
const int  h1,
const int  h2,
const int  outputDim,
TrainingConfig  config,
const bool  isNoisy = false,
InitType  init = InitType(),
OutputLayerType  outputLayer = OutputLayerType() 
)
inline

Construct an instance of CategoricalDQN class.

Parameters
inputDimNumber of inputs.
h1Number of neurons in hiddenlayer-1.
h2Number of neurons in hiddenlayer-2.
outputDimNumber of neurons in output layer.
configHyper-parameters for categorical dqn.
isNoisySpecifies whether the network needs to be of type noisy.
initSpecifies the initialization rule for the network.
outputLayerSpecifies the output layer type for network.

◆ CategoricalDQN() [2/2]

template<typename OutputLayerType = EmptyLoss<>, typename InitType = GaussianInitialization, typename NetworkType = FFN<OutputLayerType, InitType>>
mlpack::rl::CategoricalDQN< OutputLayerType, InitType, NetworkType >::CategoricalDQN ( NetworkType &  network,
TrainingConfig  config,
const bool  isNoisy = false 
)
inline

Construct an instance of CategoricalDQN class from a pre-constructed network.

Parameters
networkThe network to be used by CategoricalDQN class.
configHyper-parameters for categorical dqn.
isNoisySpecifies whether the network needs to be of type noisy.

Member Function Documentation

◆ Backward()

template<typename OutputLayerType = EmptyLoss<>, typename InitType = GaussianInitialization, typename NetworkType = FFN<OutputLayerType, InitType>>
void mlpack::rl::CategoricalDQN< OutputLayerType, InitType, NetworkType >::Backward ( const arma::mat  state,
arma::mat &  lossGradients,
arma::mat &  gradient 
)
inline

Perform the backward pass of the state in real batch mode.

Parameters
stateThe input state.
lossGradientsThe loss gradients.
gradientThe gradient.

◆ Forward()

template<typename OutputLayerType = EmptyLoss<>, typename InitType = GaussianInitialization, typename NetworkType = FFN<OutputLayerType, InitType>>
void mlpack::rl::CategoricalDQN< OutputLayerType, InitType, NetworkType >::Forward ( const arma::mat  state,
arma::mat &  dist 
)
inline

Perform the forward pass of the states in real batch mode.

Parameters
stateThe input state.
distThe predicted distributions.

◆ Predict()

template<typename OutputLayerType = EmptyLoss<>, typename InitType = GaussianInitialization, typename NetworkType = FFN<OutputLayerType, InitType>>
void mlpack::rl::CategoricalDQN< OutputLayerType, InitType, NetworkType >::Predict ( const arma::mat  state,
arma::mat &  actionValue 
)
inline

Predict the responses to a given set of predictors.

The responses will reflect the output of the given output layer as returned by the output layer function.

If you want to pass in a parameter and discard the original parameter object, be sure to use std::move to avoid unnecessary copy.

Parameters
stateInput state.
actionValueMatrix to put output action values of states input.

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