mlpack  master
mean_squared_error.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_METHODS_ANN_LAYER_MEAN_SQUARED_ERROR_HPP
13 #define MLPACK_METHODS_ANN_LAYER_MEAN_SQUARED_ERROR_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace ann {
19 
30 template <
31  typename InputDataType = arma::mat,
32  typename OutputDataType = arma::mat
33 >
35 {
36  public:
41 
42  /*
43  * Computes the mean squared error function.
44  *
45  * @param input Input data used for evaluating the specified function.
46  * @param output Resulting output activation.
47  */
48  template<typename eT>
49  double Forward(const arma::Mat<eT>&& input, const arma::Mat<eT>&& target);
57  template<typename eT>
58  void Backward(const arma::Mat<eT>&& input,
59  const arma::Mat<eT>&& target,
60  arma::Mat<eT>&& output);
61 
63  InputDataType& InputParameter() const { return inputParameter; }
65  InputDataType& InputParameter() { return inputParameter; }
66 
68  OutputDataType& OutputParameter() const { return outputParameter; }
70  OutputDataType& OutputParameter() { return outputParameter; }
71 
73  OutputDataType& Delta() const { return delta; }
75  OutputDataType& Delta() { return delta; }
76 
80  template<typename Archive>
81  void Serialize(Archive& ar, const unsigned int /* version */);
82 
83  private:
85  OutputDataType delta;
86 
88  InputDataType inputParameter;
89 
91  OutputDataType outputParameter;
92 }; // class MeanSquaredError
93 
94 } // namespace ann
95 } // namespace mlpack
96 
97 // Include implementation.
98 #include "mean_squared_error_impl.hpp"
99 
100 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: binarize.hpp:18
OutputDataType & OutputParameter() const
Get the output parameter.
double Forward(const arma::Mat< eT > &&input, const arma::Mat< eT > &&target)
The core includes that mlpack expects; standard C++ includes and Armadillo.
InputDataType inputParameter
Locally-stored input parameter object.
InputDataType & InputParameter()
Modify the input parameter.
OutputDataType & Delta()
Modify the delta.
OutputDataType & OutputParameter()
Modify the output parameter.
The mean squared error performance function measures the network&#39;s performance according to the mean ...
OutputDataType outputParameter
Locally-stored output parameter object.
InputDataType & InputParameter() const
Get the input parameter.
OutputDataType delta
Locally-stored delta object.
MeanSquaredError()
Create the MeanSquaredError object.
void Serialize(Archive &ar, const unsigned int)
Serialize the layer.
OutputDataType & Delta() const
Get the delta.
void Backward(const arma::Mat< eT > &&input, const arma::Mat< eT > &&target, arma::Mat< eT > &&output)
Ordinary feed backward pass of a neural network.