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

Implementation of the Sequential class. More...

Public Member Functions

 Sequential (const bool model=true)
 Create the Sequential object using the specified parameters. More...
 
 ~Sequential ()
 Destroy the Sequential object. More...
 
template<class LayerType , class... Args>
void Add (Args...args)
 
void Add (LayerTypes layer)
 
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, using 3rd-order tensors as input, calculating the function f(x) by propagating x backwards through f. More...
 
arma::mat const & Delta () const
 Get the delta.e. More...
 
arma::mat & Delta ()
 Modify the delta. 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 > &&)
 
arma::mat const & Gradient () const
 Get the gradient. More...
 
arma::mat & Gradient ()
 Modify the gradient. More...
 
arma::mat const & InputParameter () const
 
arma::mat & InputParameter ()
 Modify the input parameter. More...
 
std::vector< LayerTypes > & Model ()
 Return the model modules. More...
 
arma::mat const & OutputParameter () const
 Get the output parameter. More...
 
arma::mat & OutputParameter ()
 Modify the output parameter. More...
 
const arma::mat & Parameters () const
 Return the initial point for the optimization. More...
 
arma::mat & Parameters ()
 Modify the initial point for the optimization. More...
 
template<typename Archive >
void Serialize (Archive &, const unsigned int)
 Serialize the layer. More...
 

Private Attributes

DeleteVisitor deleteVisitor
 Locally-stored delete visitor. More...
 
arma::mat delta
 Locally-stored delta object. More...
 
DeltaVisitor deltaVisitor
 Locally-stored delta visitor. More...
 
std::vector< LayerTypesempty
 Locally-stored empty list of modules. More...
 
arma::mat gradient
 Locally-stored gradient object. More...
 
size_t height
 The input height. More...
 
arma::mat inputParameter
 Locally-stored input parameter object. More...
 
bool model
 Parameter which indicates if the modules should be exposed. More...
 
std::vector< LayerTypesnetwork
 Locally-stored network modules. More...
 
OutputHeightVisitor outputHeightVisitor
 Locally-stored output height visitor. More...
 
arma::mat outputParameter
 Locally-stored output parameter object. More...
 
OutputParameterVisitor outputParameterVisitor
 Locally-stored output parameter visitor. More...
 
OutputWidthVisitor outputWidthVisitor
 Locally-stored output width visitor. More...
 
arma::mat parameters
 Locally-stored model parameters. More...
 
bool reset
 Indicator if we already initialized the model. More...
 
size_t width
 The input width. More...
 

Detailed Description

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

Implementation of the Sequential class.

The sequential class works as a feed-forward fully connected network container which plugs various layers together.

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

Constructor & Destructor Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
mlpack::ann::Sequential< InputDataType, OutputDataType >::Sequential ( const bool  model = true)

Create the Sequential object using the specified parameters.

Parameters
modelExpose the all network modules.
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
mlpack::ann::Sequential< InputDataType, OutputDataType >::~Sequential ( )

Destroy the Sequential object.

Member Function Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<class LayerType , class... Args>
void mlpack::ann::Sequential< InputDataType, OutputDataType >::Add ( Args...  args)
inline
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
void mlpack::ann::Sequential< InputDataType, OutputDataType >::Add ( LayerTypes  layer)
inline
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename eT >
void mlpack::ann::Sequential< InputDataType, OutputDataType >::Backward ( const arma::Mat< eT > &&  ,
arma::Mat< eT > &&  gy,
arma::Mat< eT > &&  g 
)

Ordinary feed backward pass of a neural network, using 3rd-order tensors as input, calculating the function f(x) by propagating x backwards through 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>
arma::mat const& mlpack::ann::Sequential< InputDataType, OutputDataType >::Delta ( ) const
inline

Get the delta.e.

Definition at line 137 of file sequential.hpp.

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

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

Modify the delta.

Definition at line 139 of file sequential.hpp.

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

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
template<typename eT >
void mlpack::ann::Sequential< 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::Sequential< InputDataType, OutputDataType >::Gradient ( arma::Mat< eT > &&  input,
arma::Mat< eT > &&  error,
arma::Mat< eT > &&   
)
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
arma::mat const& mlpack::ann::Sequential< InputDataType, OutputDataType >::Gradient ( ) const
inline

Get the gradient.

Definition at line 142 of file sequential.hpp.

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

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

Modify the input parameter.

Definition at line 129 of file sequential.hpp.

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

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

Get the output parameter.

Definition at line 132 of file sequential.hpp.

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

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

Modify the output parameter.

Definition at line 134 of file sequential.hpp.

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

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

Return the initial point for the optimization.

Definition at line 123 of file sequential.hpp.

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

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

Modify the initial point for the optimization.

Definition at line 125 of file sequential.hpp.

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

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

Member Data Documentation

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
DeleteVisitor mlpack::ann::Sequential< InputDataType, OutputDataType >::deleteVisitor
private

Locally-stored delete visitor.

Definition at line 172 of file sequential.hpp.

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

Locally-stored delta object.

Definition at line 178 of file sequential.hpp.

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

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

Locally-stored delta visitor.

Definition at line 166 of file sequential.hpp.

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

Locally-stored empty list of modules.

Definition at line 175 of file sequential.hpp.

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

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

Locally-stored gradient object.

Definition at line 187 of file sequential.hpp.

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

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t mlpack::ann::Sequential< InputDataType, OutputDataType >::height
private

The input height.

Definition at line 199 of file sequential.hpp.

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

Locally-stored input parameter object.

Definition at line 181 of file sequential.hpp.

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

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
bool mlpack::ann::Sequential< InputDataType, OutputDataType >::model
private

Parameter which indicates if the modules should be exposed.

Definition at line 154 of file sequential.hpp.

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

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

Locally-stored output height visitor.

Definition at line 193 of file sequential.hpp.

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

Locally-stored output parameter object.

Definition at line 184 of file sequential.hpp.

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

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

Locally-stored output parameter visitor.

Definition at line 169 of file sequential.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
OutputWidthVisitor mlpack::ann::Sequential< InputDataType, OutputDataType >::outputWidthVisitor
private

Locally-stored output width visitor.

Definition at line 190 of file sequential.hpp.

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

Locally-stored model parameters.

Definition at line 163 of file sequential.hpp.

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

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
bool mlpack::ann::Sequential< InputDataType, OutputDataType >::reset
private

Indicator if we already initialized the model.

Definition at line 157 of file sequential.hpp.

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
size_t mlpack::ann::Sequential< InputDataType, OutputDataType >::width
private

The input width.

Definition at line 196 of file sequential.hpp.


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