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

Implementation of the RecurrentLayer class. More...

Public Member Functions

template<typename StartModuleType , typename InputModuleType , typename FeedbackModuleType , typename TransferModuleType >
 Recurrent (const StartModuleType &start, const InputModuleType &input, const FeedbackModuleType &feedback, const TransferModuleType &transfer, const size_t rho)
 Create the Recurrent object using the specified modules. More...
 
template<typename eT >
void Backward (const arma::Mat< eT > &&, arma::Mat< eT > &&gy, arma::Mat< eT > &&g)
 Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards trough f. More...
 
OutputDataType const & Delta () const
 Get the delta. More...
 
OutputDataType & Delta ()
 Modify the delta. More...
 
bool Deterministic () const
 The value of the deterministic parameter. More...
 
bool & Deterministic ()
 Modify the value of the deterministic parameter. More...
 
template<typename eT >
void Forward (arma::Mat< eT > &&input, arma::Mat< eT > &&output)
 Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f. More...
 
template<typename eT >
void Gradient (arma::Mat< eT > &&input, arma::Mat< eT > &&error, arma::Mat< eT > &&)
 
OutputDataType const & Gradient () const
 Get the gradient. More...
 
OutputDataType & Gradient ()
 Modify the gradient. More...
 
InputDataType const & InputParameter () const
 Get the input parameter. More...
 
InputDataType & InputParameter ()
 Modify the input parameter. More...
 
std::vector< LayerTypes > & Model ()
 Get the model modules. More...
 
OutputDataType const & OutputParameter () const
 Get the output parameter. More...
 
OutputDataType & OutputParameter ()
 Modify the output parameter. More...
 
OutputDataType const & Parameters () const
 Get the parameters. More...
 
OutputDataType & Parameters ()
 Modify the parameters. More...
 
template<typename Archive >
void Serialize (Archive &ar, const unsigned int)
 Serialize the layer. More...
 

Private Attributes

size_t backwardStep
 Locally-stored number of backward steps. More...
 
OutputDataType delta
 Locally-stored delta object. More...
 
DeltaVisitor deltaVisitor
 Locally-stored delta visitor. More...
 
bool deterministic
 If true dropout and scaling is disabled, see notes above. More...
 
LayerTypes feedbackModule
 Locally-stored feedback module. More...
 
std::vector< arma::mat > feedbackOutputParameter
 Locally-stored feedback output parameters. More...
 
size_t forwardStep
 Locally-stored number of forward steps. More...
 
OutputDataType gradient
 Locally-stored gradient object. More...
 
size_t gradientStep
 Locally-stored number of gradient steps. More...
 
LayerTypes initialModule
 Locally-stored initial module. More...
 
LayerTypes inputModule
 Locally-stored input module. More...
 
InputDataType inputParameter
 Locally-stored input parameter object. More...
 
LayerTypes mergeModule
 Locally-stored merge module. More...
 
std::vector< LayerTypesnetwork
 Locally-stored model modules. More...
 
OutputDataType outputParameter
 Locally-stored output parameter object. More...
 
OutputParameterVisitor outputParameterVisitor
 Locally-stored output parameter visitor. More...
 
OutputDataType parameters
 Locally-stored weight object. More...
 
arma::mat recurrentError
 Locally-stored recurrent error parameter. More...
 
LayerTypes recurrentModule
 Locally-stored recurrent module. More...
 
size_t rho
 Number of steps to backpropagate through time (BPTT). More...
 
LayerTypes startModule
 Locally-stored start module. More...
 
LayerTypes transferModule
 Locally-stored transfer module. More...
 
WeightSizeVisitor weightSizeVisitor
 Locally-stored weight size visitor. More...
 

Detailed Description

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

Implementation of the RecurrentLayer class.

Recurrent layers can be used similarly to feed-forward layers.

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 52 of file layer_types.hpp.

Constructor & Destructor Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename StartModuleType , typename InputModuleType , typename FeedbackModuleType , typename TransferModuleType >
mlpack::ann::Recurrent< InputDataType, OutputDataType >::Recurrent ( const StartModuleType &  start,
const InputModuleType &  input,
const FeedbackModuleType &  feedback,
const TransferModuleType &  transfer,
const size_t  rho 
)

Create the Recurrent object using the specified modules.

Parameters
startThe start module.
startThe input module.
startThe feedback module.
startThe transfer module.
rhoMaximum number of steps to backpropagate through time (BPTT).

Member Function Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename eT >
void mlpack::ann::Recurrent< InputDataType, OutputDataType >::Backward ( const arma::Mat< eT > &&  ,
arma::Mat< eT > &&  gy,
arma::Mat< eT > &&  g 
)

Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards trough f.

Using the results from the feed forward pass.

Parameters
inputThe propagated input activation.
gyThe backpropagated error.
gThe calculated gradient.
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType const& mlpack::ann::Recurrent< InputDataType, OutputDataType >::Delta ( ) const
inline

Get the delta.

Definition at line 125 of file recurrent.hpp.

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

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

Modify the delta.

Definition at line 127 of file recurrent.hpp.

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

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

The value of the deterministic parameter.

Definition at line 105 of file recurrent.hpp.

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

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

Modify the value of the deterministic parameter.

Definition at line 107 of file recurrent.hpp.

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

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename eT >
void mlpack::ann::Recurrent< InputDataType, OutputDataType >::Forward ( arma::Mat< eT > &&  input,
arma::Mat< eT > &&  output 
)

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

Parameters
inputInput data used for evaluating the specified function.
outputResulting output activation.
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename eT >
void mlpack::ann::Recurrent< InputDataType, OutputDataType >::Gradient ( arma::Mat< eT > &&  input,
arma::Mat< eT > &&  error,
arma::Mat< eT > &&   
)
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType const& mlpack::ann::Recurrent< InputDataType, OutputDataType >::Gradient ( ) const
inline

Get the gradient.

Definition at line 130 of file recurrent.hpp.

References mlpack::ann::Recurrent< InputDataType, OutputDataType >::gradient.

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

Get the input parameter.

Definition at line 115 of file recurrent.hpp.

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

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

Modify the input parameter.

Definition at line 117 of file recurrent.hpp.

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

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
std::vector<LayerTypes>& mlpack::ann::Recurrent< InputDataType, OutputDataType >::Model ( )
inline

Get the model modules.

Definition at line 102 of file recurrent.hpp.

References mlpack::ann::Recurrent< InputDataType, OutputDataType >::network.

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

Get the output parameter.

Definition at line 120 of file recurrent.hpp.

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

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

Modify the output parameter.

Definition at line 122 of file recurrent.hpp.

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

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

Get the parameters.

Definition at line 110 of file recurrent.hpp.

References mlpack::ann::Recurrent< InputDataType, OutputDataType >::parameters.

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

Modify the parameters.

Definition at line 112 of file recurrent.hpp.

References mlpack::ann::Recurrent< InputDataType, OutputDataType >::parameters.

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

Member Data Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t mlpack::ann::Recurrent< InputDataType, OutputDataType >::backwardStep
private

Locally-stored number of backward steps.

Definition at line 160 of file recurrent.hpp.

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

Locally-stored delta object.

Definition at line 196 of file recurrent.hpp.

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

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
DeltaVisitor mlpack::ann::Recurrent< InputDataType, OutputDataType >::deltaVisitor
private

Locally-stored delta visitor.

Definition at line 187 of file recurrent.hpp.

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

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

Definition at line 166 of file recurrent.hpp.

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

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
LayerTypes mlpack::ann::Recurrent< InputDataType, OutputDataType >::feedbackModule
private

Locally-stored feedback module.

Definition at line 148 of file recurrent.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
std::vector<arma::mat> mlpack::ann::Recurrent< InputDataType, OutputDataType >::feedbackOutputParameter
private

Locally-stored feedback output parameters.

Definition at line 193 of file recurrent.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t mlpack::ann::Recurrent< InputDataType, OutputDataType >::forwardStep
private

Locally-stored number of forward steps.

Definition at line 157 of file recurrent.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType mlpack::ann::Recurrent< InputDataType, OutputDataType >::gradient
private

Locally-stored gradient object.

Definition at line 199 of file recurrent.hpp.

Referenced by mlpack::ann::Recurrent< InputDataType, OutputDataType >::Gradient().

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t mlpack::ann::Recurrent< InputDataType, OutputDataType >::gradientStep
private

Locally-stored number of gradient steps.

Definition at line 163 of file recurrent.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
LayerTypes mlpack::ann::Recurrent< InputDataType, OutputDataType >::initialModule
private

Locally-stored initial module.

Definition at line 172 of file recurrent.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
LayerTypes mlpack::ann::Recurrent< InputDataType, OutputDataType >::inputModule
private

Locally-stored input module.

Definition at line 145 of file recurrent.hpp.

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

Locally-stored input parameter object.

Definition at line 202 of file recurrent.hpp.

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

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
LayerTypes mlpack::ann::Recurrent< InputDataType, OutputDataType >::mergeModule
private

Locally-stored merge module.

Definition at line 181 of file recurrent.hpp.

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

Locally-stored model modules.

Definition at line 178 of file recurrent.hpp.

Referenced by mlpack::ann::Recurrent< InputDataType, OutputDataType >::Model().

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

Locally-stored output parameter object.

Definition at line 205 of file recurrent.hpp.

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

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputParameterVisitor mlpack::ann::Recurrent< InputDataType, OutputDataType >::outputParameterVisitor
private

Locally-stored output parameter visitor.

Definition at line 190 of file recurrent.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputDataType mlpack::ann::Recurrent< InputDataType, OutputDataType >::parameters
private

Locally-stored weight object.

Definition at line 169 of file recurrent.hpp.

Referenced by mlpack::ann::Recurrent< InputDataType, OutputDataType >::Parameters().

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
arma::mat mlpack::ann::Recurrent< InputDataType, OutputDataType >::recurrentError
private

Locally-stored recurrent error parameter.

Definition at line 208 of file recurrent.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
LayerTypes mlpack::ann::Recurrent< InputDataType, OutputDataType >::recurrentModule
private

Locally-stored recurrent module.

Definition at line 175 of file recurrent.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t mlpack::ann::Recurrent< InputDataType, OutputDataType >::rho
private

Number of steps to backpropagate through time (BPTT).

Definition at line 154 of file recurrent.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
LayerTypes mlpack::ann::Recurrent< InputDataType, OutputDataType >::startModule
private

Locally-stored start module.

Definition at line 142 of file recurrent.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
LayerTypes mlpack::ann::Recurrent< InputDataType, OutputDataType >::transferModule
private

Locally-stored transfer module.

Definition at line 151 of file recurrent.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
WeightSizeVisitor mlpack::ann::Recurrent< InputDataType, OutputDataType >::weightSizeVisitor
private

Locally-stored weight size visitor.

Definition at line 184 of file recurrent.hpp.


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