mlpack 3.4.2
cross_entropy_error.hpp
Go to the documentation of this file.
1
12#ifndef MLPACK_METHODS_ANN_LOSS_FUNCTIONS_CROSS_ENTROPY_ERROR_HPP
13#define MLPACK_METHODS_ANN_LOSS_FUNCTIONS_CROSS_ENTROPY_ERROR_HPP
14
15#include <mlpack/prereqs.hpp>
16
17namespace mlpack {
18namespace ann {
19
30template <
31 typename InputDataType = arma::mat,
32 typename OutputDataType = arma::mat
33>
35{
36 public:
43 CrossEntropyError(const double eps = 1e-10);
44
51 template<typename InputType, typename TargetType>
52 typename InputType::elem_type Forward(const InputType& input,
53 const TargetType& target);
54
62 template<typename InputType, typename TargetType, typename OutputType>
63 void Backward(const InputType& input,
64 const TargetType& target,
65 OutputType& output);
66
68 OutputDataType& OutputParameter() const { return outputParameter; }
70 OutputDataType& OutputParameter() { return outputParameter; }
71
73 double Eps() const { return eps; }
75 double& Eps() { return eps; }
76
80 template<typename Archive>
81 void serialize(Archive& ar, const unsigned int /* version */);
82
83 private:
85 OutputDataType outputParameter;
86
88 double eps;
89}; // class CrossEntropyError
90
91} // namespace ann
92} // namespace mlpack
93
94// Include implementation.
95#include "cross_entropy_error_impl.hpp"
96
97#endif
The cross-entropy performance function measures the network's performance according to the cross-entr...
CrossEntropyError(const double eps=1e-10)
Create the CrossEntropyError object.
OutputDataType & OutputParameter() const
Get the output parameter.
double Eps() const
Get the epsilon.
void Backward(const InputType &input, const TargetType &target, OutputType &output)
Ordinary feed backward pass of a neural network.
InputType::elem_type Forward(const InputType &input, const TargetType &target)
Computes the cross-entropy function.
double & Eps()
Modify the epsilon.
OutputDataType & OutputParameter()
Modify the output parameter.
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
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.