reconstruction_loss.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_METHODS_ANN_LOSS_FUNCTION_RECONSTRUCTION_LOSS_HPP
13 #define MLPACK_METHODS_ANN_LOSS_FUNCTION_RECONSTRUCTION_LOSS_HPP
14 
15 #include <mlpack/prereqs.hpp>
17 
18 namespace mlpack {
19 namespace ann {
20 
32 template <
33  typename InputDataType = arma::mat,
34  typename OutputDataType = arma::mat,
35  typename DistType = BernoulliDistribution<InputDataType>
36 >
38 {
39  public:
44 
52  template<typename PredictionType, typename TargetType>
53  typename PredictionType::elem_type Forward(const PredictionType& prediction,
54  const TargetType& target);
55 
64  template<typename PredictionType, typename TargetType, typename LossType>
65  void Backward(const PredictionType& prediction,
66  const TargetType& target,
67  LossType& loss);
68 
70  OutputDataType& OutputParameter() const { return outputParameter; }
72  OutputDataType& OutputParameter() { return outputParameter; }
73 
77  template<typename Archive>
78  void serialize(Archive& ar, const uint32_t /* version */);
79 
80  private:
82  DistType dist;
83 
85  OutputDataType outputParameter;
86 }; // class ReconstructionLoss
87 
88 } // namespace ann
89 } // namespace mlpack
90 
91 // Include implementation.
92 #include "reconstruction_loss_impl.hpp"
93 
94 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
ReconstructionLoss()
Create the ReconstructionLoss object.
The core includes that mlpack expects; standard C++ includes and Armadillo.
The reconstruction loss performance function measures the network&#39;s performance equal to the negative...
void Backward(const PredictionType &prediction, const TargetType &target, LossType &loss)
Ordinary feed backward pass of a neural network.
OutputDataType & OutputParameter()
Modify the output parameter.
PredictionType::elem_type Forward(const PredictionType &prediction, const TargetType &target)
Computes the reconstruction loss.
OutputDataType & OutputParameter() const
Get the output parameter.
void serialize(Archive &ar, const uint32_t)
Serialize the layer.