mlpack
Public Member Functions | List of all members
mlpack::ann::VRClassReward< InputDataType, OutputDataType > Class Template Reference

Implementation of the variance reduced classification reinforcement layer. More...

#include <vr_class_reward.hpp>

Public Member Functions

 VRClassReward (const double scale=1, const bool sizeAverage=true)
 Create the VRClassReward object. More...
 
template<typename InputType , typename TargetType >
double Forward (const InputType &input, const TargetType &target)
 Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f. More...
 
template<typename InputType , typename TargetType , typename OutputType >
void Backward (const InputType &input, const TargetType &target, OutputType &output)
 Ordinary feed backward pass of a neural network. More...
 
OutputDataType & OutputParameter () const
 Get the output parameter.
 
OutputDataType & OutputParameter ()
 Modify the output parameter.
 
OutputDataType & Delta () const
 Get the delta.
 
OutputDataType & Delta ()
 Modify the delta.
 
template<class LayerType , class... Args>
void Add (Args... args)
 
void Add (LayerTypes<> layer)
 
std::vector< LayerTypes<> > & Model ()
 Get the network modules.
 
bool SizeAverage () const
 Get the value of parameter sizeAverage.
 
double Scale () const
 Get the value of scale parameter.
 
template<typename Archive >
void serialize (Archive &, const uint32_t)
 Serialize the layer.
 

Detailed Description

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
class mlpack::ann::VRClassReward< InputDataType, OutputDataType >

Implementation of the variance reduced classification reinforcement layer.

This layer is meant to be used in combination with the reinforce normal layer (ReinforceNormalLayer), which expects that an reward: (1 for success, 0 otherwise).

Template Parameters
InputDataTypeType of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).
OutputDataTypeType of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).

Constructor & Destructor Documentation

◆ VRClassReward()

template<typename InputDataType , typename OutputDataType >
mlpack::ann::VRClassReward< InputDataType, OutputDataType >::VRClassReward ( const double  scale = 1,
const bool  sizeAverage = true 
)

Create the VRClassReward object.

Parameters
scaleParameter used to scale the reward.
sizeAverageTake the average over all batches.

Member Function Documentation

◆ Backward()

template<typename InputDataType , typename OutputDataType >
template<typename InputType , typename TargetType , typename OutputType >
void mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Backward ( const InputType &  input,
const TargetType &  target,
OutputType &  output 
)

Ordinary feed backward pass of a neural network.

The negative log likelihood layer expectes that the input contains log-probabilities for each class. The layer also expects a class index, in the range between 1 and the number of classes, as target when calling the Forward function.

Parameters
inputThe propagated input activation.
targetThe target vector, that contains the class index in the range between 1 and the number of classes.
outputThe calculated error.

◆ Forward()

template<typename InputDataType , typename OutputDataType >
template<typename InputType , typename TargetType >
double mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Forward ( const InputType &  input,
const TargetType &  target 
)

Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f.

Parameters
inputInput data that contains the log-probabilities for each class.
targetThe target vector, that contains the class index in the range between 1 and the number of classes.

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