12 #ifndef MLPACK_METHODS_ANN_FFN_HPP 13 #define MLPACK_METHODS_ANN_FFN_HPP 40 typename OutputLayerType = NegativeLogLikelihood<>,
41 typename InitializationRuleType = RandomInitialization
98 void Train(
const arma::mat& predictors,
99 const arma::mat& responses,
100 OptimizerType<NetworkType>& optimizer);
118 void Train(
const arma::mat& predictors,
const arma::mat& responses);
128 void Predict(arma::mat& predictors, arma::mat& responses);
139 double Evaluate(
const arma::mat& parameters,
152 void Gradient(
const arma::mat& parameters,
161 template <
class LayerType,
class... Args>
162 void Add(Args... args) {
network.push_back(
new LayerType(args...)); }
180 template<
typename Archive>
181 void Serialize(Archive& ar,
const unsigned int );
191 void Forward(arma::mat&& input);
302 #include "ffn_impl.hpp" void Train(const arma::mat &predictors, const arma::mat &responses, OptimizerType< NetworkType > &optimizer)
Train the feedforward network on the given input data using the given optimizer.
DeleteVisitor executes the destructor of the instantiated object.
OutputWidthVisitor exposes the OutputHeight() method of the given module.
void Backward()
The Backward algorithm (part of the Forward-Backward algorithm).
OutputWidthVisitor outputWidthVisitor
Locally-stored output width visitor.
FFN(OutputLayerType &&outputLayer=OutputLayerType(), InitializationRuleType initializeRule=InitializationRuleType())
Create the FFN object with the given predictors and responses set (this is the set that is used to tr...
arma::mat parameter
Matrix of (trained) parameters.
arma::mat delta
Locally-stored delta object.
arma::mat error
The current error for the backward pass.
size_t height
The input height.
Linear algebra utility functions, generally performed on matrices or vectors.
arma::mat currentInput
THe current input of the forward/backward pass.
void ResetDeterministic()
Reset the module status by setting the current deterministic parameter for all modules that implement...
OutputHeightVisitor outputHeightVisitor
Locally-stored output height visitor.
arma::mat predictors
The matrix of data points (predictors).
The core includes that mlpack expects; standard C++ includes and Armadillo.
const arma::mat & Parameters() const
Return the initial point for the optimization.
std::vector< LayerTypes > network
Locally-stored model modules.
WeightSizeVisitor returns the number of weights of the given module.
arma::mat currentTarget
THe current target of the forward/backward pass.
OutputLayerType outputLayer
Instantiated outputlayer used to evaluate the network.
void ResetParameters()
Reset the module infomration (weights/parameters).
arma::mat inputParameter
Locally-stored input parameter object.
void Serialize(Archive &ar, const unsigned int)
Serialize the model.
DeltaVisitor deltaVisitor
Locally-stored delta visitor.
~FFN()
Destructor to release allocated memory.
arma::mat responses
The matrix of responses to the input data points.
size_t width
The input width.
ResetVisitor executes the Reset() function.
void Add(LayerTypes layer)
OutputParameterVisitor exposes the output parameter of the given module.
void Forward(arma::mat &&input)
The Forward algorithm (part of the Forward-Backward algorithm).
boost::variant< Add< arma::mat, arma::mat > *, AddMerge< arma::mat, arma::mat > *, BaseLayer< LogisticFunction, arma::mat, arma::mat > *, BaseLayer< IdentityFunction, arma::mat, arma::mat > *, BaseLayer< TanhFunction, arma::mat, arma::mat > *, BaseLayer< RectifierFunction, arma::mat, arma::mat > *, Concat< arma::mat, arma::mat > *, ConcatPerformance< NegativeLogLikelihood< arma::mat, arma::mat >, arma::mat, arma::mat > *, Constant< arma::mat, arma::mat > *, Convolution< NaiveConvolution< ValidConvolution >, NaiveConvolution< FullConvolution >, NaiveConvolution< ValidConvolution >, arma::mat, arma::mat > *, DropConnect< arma::mat, arma::mat > *, Dropout< arma::mat, arma::mat > *, Glimpse< arma::mat, arma::mat > *, HardTanH< arma::mat, arma::mat > *, Join< arma::mat, arma::mat > *, LeakyReLU< arma::mat, arma::mat > *, Linear< arma::mat, arma::mat > *, LinearNoBias< arma::mat, arma::mat > *, LogSoftMax< arma::mat, arma::mat > *, Lookup< arma::mat, arma::mat > *, LSTM< arma::mat, arma::mat > *, MaxPooling< arma::mat, arma::mat > *, MeanPooling< arma::mat, arma::mat > *, MeanSquaredError< arma::mat, arma::mat > *, MultiplyConstant< arma::mat, arma::mat > *, NegativeLogLikelihood< arma::mat, arma::mat > *, PReLU< arma::mat, arma::mat > *, Recurrent< arma::mat, arma::mat > *, RecurrentAttention< arma::mat, arma::mat > *, ReinforceNormal< arma::mat, arma::mat > *, Select< arma::mat, arma::mat > *, Sequential< arma::mat, arma::mat > *, VRClassReward< arma::mat, arma::mat > * > LayerTypes
size_t NumFunctions() const
Return the number of separable functions (the number of predictor points).
DeleteVisitor deleteVisitor
Locally-stored delete visitor.
void Predict(arma::mat &predictors, arma::mat &responses)
Predict the responses to a given set of predictors.
arma::mat outputParameter
Locally-stored output parameter object.
bool reset
Indicator if we already trained the model.
DeltaVisitor exposes the delta parameter of the given module.
void ResetGradients(arma::mat &gradient)
Reset the gradient for all modules that implement the Gradient function.
InitializationRuleType initializeRule
Instantiated InitializationRule object for initializing the network parameter.
Implementation of a standard feed forward network.
OutputParameterVisitor outputParameterVisitor
Locally-stored output parameter visitor.
OutputWidthVisitor exposes the OutputWidth() method of the given module.
void Gradient()
Iterate through all layer modules and update the the gradient using the layer defined optimizer...
arma::mat & Parameters()
Modify the initial point for the optimization.
bool deterministic
The current evaluation mode (training or testing).
double Evaluate(const arma::mat ¶meters, const size_t i, const bool deterministic=true)
Evaluate the feedforward network with the given parameters.
ResetVisitor resetVisitor
Locally-stored reset visitor.
arma::mat gradient
Locally-stored gradient parameter.
size_t numFunctions
The number of separable functions (the number of predictor points).
RMSprop is an optimizer that utilizes the magnitude of recent gradients to normalize the gradients...
WeightSizeVisitor weightSizeVisitor
Locally-stored weight size visitor.