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 InputType, typename TargetType>
50  double Forward(const InputType&& input, TargetType&& target);
51 
63  template<typename InputType, typename TargetType, typename OutputType>
64  void Backward(const InputType&& input,
65  const TargetType&& target,
66  OutputType&& 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
OutputDataType & OutputParameter() const
Get the output parameter.
OutputDataType & Delta()
Modify the delta.
.hpp
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
Implementation of the negative log likelihood layer.
NegativeLogLikelihood()
Create the NegativeLogLikelihoodLayer object.
InputDataType & InputParameter() const
Get the input parameter.
void Backward(const InputType &&input, const TargetType &&target, OutputType &&output)
Ordinary feed backward pass of a neural network.
void serialize(Archive &, const unsigned int)
Serialize the layer.
OutputDataType & OutputParameter()
Modify the output parameter.
double Forward(const InputType &&input, TargetType &&target)
InputDataType & InputParameter()
Modify the input parameter.
OutputDataType & Delta() const
Get the delta.