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

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

Public Member Functions

 VRClassReward (const double scale=1, const bool sizeAverage=true)
 Create the VRClassReward object. More...
 
template<class LayerType , class... Args>
void Add (Args...args)
 
void Add (LayerTypes layer)
 
template<typename eT >
void Backward (const arma::Mat< eT > &&input, const arma::Mat< eT > &&target, arma::Mat< eT > &&output)
 Ordinary feed backward pass of a neural network. More...
 
OutputDataType & Delta () const
 Get the delta. More...
 
OutputDataType & Delta ()
 Modify the delta. More...
 
bool Deterministic () const
 Get the value of the deterministic parameter. More...
 
bool & Deterministic ()
 Modify the value of the deterministic parameter. More...
 
template<typename eT >
double Forward (const arma::Mat< eT > &&input, const arma::Mat< eT > &&target)
 Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f. More...
 
InputDataType & InputParameter () const
 Get the input parameter. More...
 
InputDataType & InputParameter ()
 Modify the input parameter. More...
 
OutputDataType & OutputParameter () const
 Get the output parameter. More...
 
OutputDataType & OutputParameter ()
 Modify the output parameter. More...
 
template<typename Archive >
void Serialize (Archive &, const unsigned int)
 Serialize the layer. More...
 

Private Attributes

OutputDataType delta
 Locally-stored delta object. More...
 
bool deterministic
 If true dropout and scaling is disabled, see notes above. More...
 
InputDataType inputParameter
 Locally-stored input parameter object. More...
 
std::vector< LayerTypesnetwork
 Locally-stored network modules. More...
 
OutputDataType outputParameter
 Locally-stored output parameter object. More...
 
double reward
 Locally stored reward parameter. More...
 
const double scale
 Locally-stored value to scale the reward. More...
 
const bool sizeAverage
 If true take the average over all batches. More...
 

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).

Definition at line 54 of file layer_types.hpp.

Constructor & Destructor Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
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

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<class LayerType , class... Args>
void mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Add ( Args...  args)
inline
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
void mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Add ( LayerTypes  layer)
inline
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename eT >
void mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Backward ( const arma::Mat< eT > &&  input,
const arma::Mat< eT > &&  target,
arma::Mat< eT > &&  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.
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType& mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Delta ( ) const
inline

Get the delta.

Definition at line 82 of file vr_class_reward.hpp.

References mlpack::ann::VRClassReward< InputDataType, OutputDataType >::delta.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType& mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Delta ( )
inline

Modify the delta.

Definition at line 84 of file vr_class_reward.hpp.

References mlpack::ann::VRClassReward< InputDataType, OutputDataType >::delta.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
bool mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Deterministic ( ) const
inline

Get the value of the deterministic parameter.

Definition at line 87 of file vr_class_reward.hpp.

References mlpack::ann::VRClassReward< InputDataType, OutputDataType >::deterministic.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
bool& mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Deterministic ( )
inline

Modify the value of the deterministic parameter.

Definition at line 89 of file vr_class_reward.hpp.

References mlpack::ann::VRClassReward< InputDataType, OutputDataType >::deterministic.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename eT >
double mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Forward ( const arma::Mat< eT > &&  input,
const arma::Mat< eT > &&  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.
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
InputDataType& mlpack::ann::VRClassReward< InputDataType, OutputDataType >::InputParameter ( ) const
inline

Get the input parameter.

Definition at line 72 of file vr_class_reward.hpp.

References mlpack::ann::VRClassReward< InputDataType, OutputDataType >::inputParameter.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
InputDataType& mlpack::ann::VRClassReward< InputDataType, OutputDataType >::InputParameter ( )
inline

Modify the input parameter.

Definition at line 74 of file vr_class_reward.hpp.

References mlpack::ann::VRClassReward< InputDataType, OutputDataType >::inputParameter.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType& mlpack::ann::VRClassReward< InputDataType, OutputDataType >::OutputParameter ( ) const
inline

Get the output parameter.

Definition at line 77 of file vr_class_reward.hpp.

References mlpack::ann::VRClassReward< InputDataType, OutputDataType >::outputParameter.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType& mlpack::ann::VRClassReward< InputDataType, OutputDataType >::OutputParameter ( )
inline

Modify the output parameter.

Definition at line 79 of file vr_class_reward.hpp.

References mlpack::ann::VRClassReward< InputDataType, OutputDataType >::outputParameter.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename Archive >
void mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Serialize ( Archive &  ,
const unsigned  int 
)

Member Data Documentation

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

Locally-stored delta object.

Definition at line 123 of file vr_class_reward.hpp.

Referenced by mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Delta().

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
bool mlpack::ann::VRClassReward< InputDataType, OutputDataType >::deterministic
private

If true dropout and scaling is disabled, see notes above.

Definition at line 132 of file vr_class_reward.hpp.

Referenced by mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Deterministic().

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

Locally-stored input parameter object.

Definition at line 126 of file vr_class_reward.hpp.

Referenced by mlpack::ann::VRClassReward< InputDataType, OutputDataType >::InputParameter().

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
std::vector<LayerTypes> mlpack::ann::VRClassReward< InputDataType, OutputDataType >::network
private

Locally-stored network modules.

Definition at line 135 of file vr_class_reward.hpp.

Referenced by mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Add().

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

Locally-stored output parameter object.

Definition at line 129 of file vr_class_reward.hpp.

Referenced by mlpack::ann::VRClassReward< InputDataType, OutputDataType >::OutputParameter().

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
double mlpack::ann::VRClassReward< InputDataType, OutputDataType >::reward
private

Locally stored reward parameter.

Definition at line 120 of file vr_class_reward.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
const double mlpack::ann::VRClassReward< InputDataType, OutputDataType >::scale
private

Locally-stored value to scale the reward.

Definition at line 114 of file vr_class_reward.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
const bool mlpack::ann::VRClassReward< InputDataType, OutputDataType >::sizeAverage
private

If true take the average over all batches.

Definition at line 117 of file vr_class_reward.hpp.


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