LogCoshLoss< InputDataType, OutputDataType > Class Template Reference

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

Public Member Functions

 LogCoshLoss (const double a=1.0)
 Create the Log-Hyperbolic-Cosine object with the specified parameters. More...

 
double A () const
 Get the value of hyperparameter a. More...

 
double & A ()
 Modify the value of hyperparameter a. 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...

 
template
<
typename
PredictionType
,
typename
TargetType
>
PredictionType::elem_type Forward (const PredictionType &prediction, const TargetType &target)
 Computes the Log-Hyperbolic-Cosine loss function. More...

 
OutputDataType & OutputParameter () const
 Get the output parameter. More...

 
OutputDataType & OutputParameter ()
 Modify the output parameter. More...

 
template
<
typename
Archive
>
void serialize (Archive &ar, const uint32_t)
 Serialize the loss function. More...

 

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).

Definition at line 35 of file log_cosh_loss.hpp.

Constructor & Destructor Documentation

◆ LogCoshLoss()

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

◆ A() [1/2]

double A ( ) const
inline

Get the value of hyperparameter a.

Definition at line 81 of file log_cosh_loss.hpp.

◆ A() [2/2]

double& A ( )
inline

Modify the value of hyperparameter a.

Definition at line 83 of file log_cosh_loss.hpp.

References LogCoshLoss< InputDataType, OutputDataType >::serialize().

◆ Backward()

void 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()

PredictionType::elem_type 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.

◆ OutputParameter() [1/2]

OutputDataType& OutputParameter ( ) const
inline

Get the output parameter.

Definition at line 76 of file log_cosh_loss.hpp.

◆ OutputParameter() [2/2]

OutputDataType& OutputParameter ( )
inline

Modify the output parameter.

Definition at line 78 of file log_cosh_loss.hpp.

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t   
)

Serialize the loss function.

Referenced by LogCoshLoss< InputDataType, OutputDataType >::A().


The documentation for this class was generated from the following file:
  • /home/jenkins-mlpack/mlpack.org/_src/mlpack-git/src/mlpack/methods/ann/loss_functions/log_cosh_loss.hpp