mlpack  master
negative_log_likelihood.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_METHODS_ANN_LAYER_NEGATIVE_LOG_LIKELIHOOD_HPP
13 #define MLPACK_METHODS_ANN_LAYER_NEGATIVE_LOG_LIKELIHOOD_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace ann {
19 
31 template <
32  typename InputDataType = arma::mat,
33  typename OutputDataType = arma::mat
34 >
36 {
37  public:
42 
43  /*
44  * Computes the Negative log likelihood.
45  *
46  * @param input Input data used for evaluating the specified function.
47  * @param output Resulting output activation.
48  */
49  template<typename eT>
50  double Forward(const arma::Mat<eT>&& input, arma::Mat<eT>&& target);
51 
63  template<typename eT>
64  void Backward(const arma::Mat<eT>&& input,
65  const arma::Mat<eT>&& target,
66  arma::Mat<eT>&& output);
67 
69  InputDataType& InputParameter() const { return inputParameter; }
71  InputDataType& InputParameter() { return inputParameter; }
72 
74  OutputDataType& OutputParameter() const { return outputParameter; }
76  OutputDataType& OutputParameter() { return outputParameter; }
77 
79  OutputDataType& Delta() const { return delta; }
81  OutputDataType& Delta() { return delta; }
82 
86  template<typename Archive>
87  void Serialize(Archive& /* ar */, const unsigned int /* version */);
88 
89  private:
91  OutputDataType delta;
92 
94  InputDataType inputParameter;
95 
97  OutputDataType outputParameter;
98 }; // class NegativeLogLikelihood
99 
100 } // namespace ann
101 } // namespace mlpack
102 
103 // Include implementation.
104 #include "negative_log_likelihood_impl.hpp"
105 
106 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: binarize.hpp:18
InputDataType inputParameter
Locally-stored input parameter object.
OutputDataType & OutputParameter()
Modify the output parameter.
The core includes that mlpack expects; standard C++ includes and Armadillo.
NegativeLogLikelihood()
Create the NegativeLogLikelihoodLayer object.
InputDataType & InputParameter()
Modify the input parameter.
OutputDataType & OutputParameter() const
Get the output parameter.
Implementation of the negative log likelihood layer.
OutputDataType & Delta() const
Get the delta.
OutputDataType outputParameter
Locally-stored output parameter object.
OutputDataType delta
Locally-stored delta object.
InputDataType & InputParameter() const
Get the input parameter.
double Forward(const arma::Mat< eT > &&input, arma::Mat< eT > &&target)
OutputDataType & Delta()
Modify 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.
void Serialize(Archive &, const unsigned int)
Serialize the layer.