mlpack
Public Member Functions | List of all members
mlpack::ann::LogCoshLoss< InputDataType, OutputDataType > Class Template Reference

The Log-Hyperbolic-Cosine loss function is often used to improve variational auto encoder. More...

#include <log_cosh_loss.hpp>

Public Member Functions

 LogCoshLoss (const double a=1.0)
 Create the Log-Hyperbolic-Cosine object with the specified parameters. More...
 
template<typename PredictionType , typename TargetType >
PredictionType::elem_type Forward (const PredictionType &prediction, const TargetType &target)
 Computes the Log-Hyperbolic-Cosine loss function. More...
 
template<typename PredictionType , typename TargetType , typename LossType >
void Backward (const PredictionType &prediction, const TargetType &target, LossType &loss)
 Ordinary feed backward pass of a neural network. More...
 
OutputDataType & OutputParameter () const
 Get the output parameter.
 
OutputDataType & OutputParameter ()
 Modify the output parameter.
 
double A () const
 Get the value of hyperparameter a.
 
double & A ()
 Modify the value of hyperparameter a.
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t)
 Serialize the loss function.
 

Detailed Description

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
class mlpack::ann::LogCoshLoss< InputDataType, OutputDataType >

The Log-Hyperbolic-Cosine loss function is often used to improve variational auto encoder.

This function is the log of hyperbolic cosine of difference between true values and predicted values.

Template Parameters
InputDataTypeType of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).
OutputDataTypeType of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).

Constructor & Destructor Documentation

◆ LogCoshLoss()

template<typename InputDataType , typename OutputDataType >
mlpack::ann::LogCoshLoss< InputDataType, OutputDataType >::LogCoshLoss ( const double  a = 1.0)

Create the Log-Hyperbolic-Cosine object with the specified parameters.

Parameters
aA double type value for smoothening loss function. It must be positive a real number, Sharpness of loss function is directly proportional to a. It can also act as a scaling factor hence making the loss function more sensitive to small losses around the origin. Default value = 1.0.

Member Function Documentation

◆ Backward()

template<typename InputDataType , typename OutputDataType >
template<typename PredictionType , typename TargetType , typename LossType >
void mlpack::ann::LogCoshLoss< InputDataType, OutputDataType >::Backward ( const PredictionType &  prediction,
const TargetType &  target,
LossType &  loss 
)

Ordinary feed backward pass of a neural network.

Parameters
predictionPredictions used for evaluating the specified loss function.
targetThe target vector.
lossThe calculated error.

◆ Forward()

template<typename InputDataType , typename OutputDataType >
template<typename PredictionType , typename TargetType >
PredictionType::elem_type mlpack::ann::LogCoshLoss< InputDataType, OutputDataType >::Forward ( const PredictionType &  prediction,
const TargetType &  target 
)

Computes the Log-Hyperbolic-Cosine loss function.

Parameters
predictionPredictions used for evaluating the specified loss function.
targetTarget data to compare with.

The documentation for this class was generated from the following files: