mlpack 3.4.2
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
17namespace mlpack {
18namespace ann {
19
31template <
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
Implementation of the negative log likelihood layer.
InputDataType & InputParameter() const
Get the input parameter.
NegativeLogLikelihood()
Create the NegativeLogLikelihoodLayer object.
InputDataType & InputParameter()
Modify the input parameter.
OutputDataType & OutputParameter() const
Get the output parameter.
OutputDataType & Delta() const
Get the delta.
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.
InputType::elem_type Forward(const InputType &input, const TargetType &target)
Computes the Negative log likelihood.
OutputDataType & OutputParameter()
Modify the output parameter.
OutputDataType & Delta()
Modify the delta.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.