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 
17 namespace mlpack {
18 namespace ann {
19 
30 template <
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  double Forward(const InputType&& input, const TargetType&& target);
53 
61  template<typename InputType, typename TargetType, typename OutputType>
62  void Backward(const InputType&& input,
63  const TargetType&& target,
64  OutputType&& output);
65 
67  OutputDataType& OutputParameter() const { return outputParameter; }
69  OutputDataType& OutputParameter() { return outputParameter; }
70 
72  double Eps() const { return eps; }
74  double& Eps() { return eps; }
75 
79  template<typename Archive>
80  void serialize(Archive& ar, const unsigned int /* version */);
81 
82  private:
84  OutputDataType outputParameter;
85 
87  double eps;
88 }; // class CrossEntropyError
89 
90 } // namespace ann
91 } // namespace mlpack
92 
93 // Include implementation.
94 #include "cross_entropy_error_impl.hpp"
95 
96 #endif
strip_type.hpp
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
void Backward(const InputType &&input, const TargetType &&target, OutputType &&output)
Ordinary feed backward pass of a neural network.
double Eps() const
Get the epsilon.
double Forward(const InputType &&input, const TargetType &&target)
Computes the cross-entropy function.
OutputDataType & OutputParameter() const
Get the output parameter.
The cross-entropy performance function measures the network&#39;s performance according to the cross-entr...
CrossEntropyError(const double eps=1e-10)
Create the CrossEntropyError object.
double & Eps()
Modify the epsilon.
OutputDataType & OutputParameter()
Modify the output parameter.