VRClassRewardType< MatType > Class Template Reference

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

Public Member Functions

 VRClassRewardType (const double scale=1, const bool sizeAverage=true)
 Create the VRClassRewardType object. More...

 
template<typename LayerType , typename... Args>
void Add (Args... args)
 Add a new module to the model. More...

 
void Add (Layer< MatType > *layer)
 Add a new module to the model. More...

 
void Backward (const MatType &input, const MatType &target, MatType &output)
 Ordinary feed backward pass of a neural network. More...

 
MatType::elem_type Forward (const MatType &input, const MatType &target)
 Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f. More...

 
const std::vector< Layer< MatType > * > & Network () const
 Get the network. More...

 
std::vector< Layer< MatType > * > & Network ()
 Modify the network. More...

 
double Scale () const
 Get the value of scale parameter. More...

 
template
<
typename
Archive
>
void serialize (Archive &, const uint32_t)
 Serialize the layer. More...

 
bool SizeAverage () const
 Get the value of parameter sizeAverage. More...

 

Detailed Description


template
<
typename
MatType
=
arma::mat
>

class mlpack::ann::VRClassRewardType< MatType >

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 the reward is 1 for success, and 0 otherwise.

Template Parameters
MatTypeMatrix representation to accept as input and use for computation.

Definition at line 31 of file vr_class_reward.hpp.

Constructor & Destructor Documentation

◆ VRClassRewardType()

VRClassRewardType ( const double  scale = 1,
const bool  sizeAverage = true 
)

Create the VRClassRewardType object.

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

Member Function Documentation

◆ Add() [1/2]

void Add ( Args...  args)
inline

Add a new module to the model.

Parameters
argsThe layer parameter.

Definition at line 72 of file vr_class_reward.hpp.

◆ Add() [2/2]

void Add ( Layer< MatType > *  layer)
inline

Add a new module to the model.

Parameters
layerThe Layer to be added to the model.

Definition at line 79 of file vr_class_reward.hpp.

◆ Backward()

void Backward ( const MatType &  input,
const MatType &  target,
MatType &  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()

MatType::elem_type Forward ( const MatType &  input,
const MatType &  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.

◆ Network() [1/2]

const std::vector<Layer<MatType>*>& Network ( ) const
inline

Get the network.

Definition at line 85 of file vr_class_reward.hpp.

◆ Network() [2/2]

std::vector<Layer<MatType>*>& Network ( )
inline

Modify the network.

Definition at line 87 of file vr_class_reward.hpp.

◆ Scale()

double Scale ( ) const
inline

Get the value of scale parameter.

Definition at line 93 of file vr_class_reward.hpp.

References VRClassRewardType< MatType >::serialize().

◆ serialize()

void serialize ( Archive &  ,
const uint32_t   
)

Serialize the layer.

Referenced by VRClassRewardType< MatType >::Scale().

◆ SizeAverage()

bool SizeAverage ( ) const
inline

Get the value of parameter sizeAverage.

Definition at line 90 of file vr_class_reward.hpp.


The documentation for this class was generated from the following file:
  • /home/jenkins-mlpack/mlpack.org/_src/mlpack-git/src/mlpack/methods/ann/loss_functions/vr_class_reward.hpp