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 
50  template<typename InputType, typename TargetType>
51  typename InputType::elem_type Forward(const InputType& input,
52  const TargetType& target);
53 
65  template<typename InputType, typename TargetType, typename OutputType>
66  void Backward(const InputType& input,
67  const TargetType& target,
68  OutputType& output);
69 
71  InputDataType& InputParameter() const { return inputParameter; }
73  InputDataType& InputParameter() { return inputParameter; }
74 
76  OutputDataType& OutputParameter() const { return outputParameter; }
78  OutputDataType& OutputParameter() { return outputParameter; }
79 
81  OutputDataType& Delta() const { return delta; }
83  OutputDataType& Delta() { return delta; }
84 
88  template<typename Archive>
89  void serialize(Archive& /* ar */, const unsigned int /* version */);
90 
91  private:
93  OutputDataType delta;
94 
96  InputDataType inputParameter;
97 
99  OutputDataType outputParameter;
100 }; // class NegativeLogLikelihood
101 
102 } // namespace ann
103 } // namespace mlpack
104 
105 // Include implementation.
106 #include "negative_log_likelihood_impl.hpp"
107 
108 #endif
OutputDataType & OutputParameter() const
Get the output parameter.
OutputDataType & Delta()
Modify the delta.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
Implementation of the negative log likelihood layer.
void Backward(const InputType &input, const TargetType &target, OutputType &output)
Ordinary feed backward pass of a neural network.
NegativeLogLikelihood()
Create the NegativeLogLikelihoodLayer object.
InputDataType & InputParameter() const
Get the input parameter.
InputType::elem_type Forward(const InputType &input, const TargetType &target)
Computes the Negative log likelihood.
void serialize(Archive &, const unsigned int)
Serialize the layer.
OutputDataType & OutputParameter()
Modify the output parameter.
InputDataType & InputParameter()
Modify the input parameter.
OutputDataType & Delta() const
Get the delta.