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 
51  template<typename PredictionType, typename TargetType>
52  typename PredictionType::elem_type Forward(const PredictionType& prediction,
53  const TargetType& target);
54 
67  template<typename PredictionType, typename TargetType, typename LossType>
68  void Backward(const PredictionType& prediction,
69  const TargetType& target,
70  LossType& loss);
71 
73  InputDataType& InputParameter() const { return inputParameter; }
75  InputDataType& InputParameter() { return inputParameter; }
76 
78  OutputDataType& OutputParameter() const { return outputParameter; }
80  OutputDataType& OutputParameter() { return outputParameter; }
81 
83  OutputDataType& Delta() const { return delta; }
85  OutputDataType& Delta() { return delta; }
86 
90  template<typename Archive>
91  void serialize(Archive& /* ar */, const uint32_t /* version */);
92 
93  private:
95  OutputDataType delta;
96 
98  InputDataType inputParameter;
99 
101  OutputDataType outputParameter;
102 }; // class NegativeLogLikelihood
103 
104 } // namespace ann
105 } // namespace mlpack
106 
107 // Include implementation.
108 #include "negative_log_likelihood_impl.hpp"
109 
110 #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.
NegativeLogLikelihood()
Create the NegativeLogLikelihoodLayer object.
void Backward(const PredictionType &prediction, const TargetType &target, LossType &loss)
Ordinary feed backward pass of a neural network.
InputDataType & InputParameter() const
Get the input parameter.
PredictionType::elem_type Forward(const PredictionType &prediction, const TargetType &target)
Computes the Negative log likelihood.
OutputDataType & OutputParameter()
Modify the output parameter.
void serialize(Archive &, const uint32_t)
Serialize the layer.
InputDataType & InputParameter()
Modify the input parameter.
OutputDataType & Delta() const
Get the delta.