mlpack 3.4.2
log_cosh_loss.hpp
Go to the documentation of this file.
1
13#ifndef MLPACK_METHODS_ANN_LOSS_FUNCTION_LOG_COSH_LOSS_HPP
14#define MLPACK_METHODS_ANN_LOSS_FUNCTION_LOG_COSH_LOSS_HPP
15
16#include <mlpack/prereqs.hpp>
17
18namespace mlpack {
19namespace ann {
20
31template <
32 typename InputDataType = arma::mat,
33 typename OutputDataType = arma::mat
34>
36{
37 public:
49 LogCoshLoss(const double a = 1.0);
50
57 template<typename InputType, typename TargetType>
58 typename InputType::elem_type Forward(const InputType& input,
59 const TargetType& target);
60
68 template<typename InputType, typename TargetType, typename OutputType>
69 void Backward(const InputType& input,
70 const TargetType& target,
71 OutputType& output);
72
74 OutputDataType& OutputParameter() const { return outputParameter; }
76 OutputDataType& OutputParameter() { return outputParameter; }
77
79 double A() const { return a; }
81 double& A() { return a; }
82
86 template<typename Archive>
87 void serialize(Archive& ar, const unsigned int /* version */);
88
89 private:
91 OutputDataType outputParameter;
92
94 double a;
95}; // class LogCoshLoss
96
97} // namespace ann
98} // namespace mlpack
99
100// include implementation
101#include "log_cosh_loss_impl.hpp"
102
103#endif
The Log-Hyperbolic-Cosine loss function is often used to improve variational auto encoder.
OutputDataType & OutputParameter() const
Get the output parameter.
void Backward(const InputType &input, const TargetType &target, OutputType &output)
Ordinary feed backward pass of a neural network.
LogCoshLoss(const double a=1.0)
Create the Log-Hyperbolic-Cosine object with the specified parameters.
double A() const
Get the value of hyperparameter a.
InputType::elem_type Forward(const InputType &input, const TargetType &target)
Computes the Log-Hyperbolic-Cosine loss function.
OutputDataType & OutputParameter()
Modify the output parameter.
double & A()
Modify the value of hyperparameter a.
void serialize(Archive &ar, const unsigned int)
Serialize the loss function.
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.