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

The Huber loss is a loss function used in robust regression, that is less sensitive to outliers in data than the squared error loss. More...

#include <huber_loss.hpp>

Public Member Functions

 HuberLoss (const double delta=1.0, const bool mean=true)
 Create the HuberLoss object. More...
 
template<typename PredictionType , typename TargetType >
PredictionType::elem_type Forward (const PredictionType &prediction, const TargetType &target)
 Computes the Huber 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 Delta () const
 Get the value of delta.
 
double & Delta ()
 Set the value of delta.
 
bool Mean () const
 Get the value of reduction type.
 
bool & Mean ()
 Set the value of reduction type.
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t)
 Serialize the layer.
 

Detailed Description

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

The Huber loss is a loss function used in robust regression, that is less sensitive to outliers in data than the squared error loss.

This function is quadratic for small values of \( y - f(x) \), and linear for large values, with equal values and slopes of the different sections at the two points where \( |y - f(x)| = delta \).

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

◆ HuberLoss()

template<typename InputDataType , typename OutputDataType >
mlpack::ann::HuberLoss< InputDataType, OutputDataType >::HuberLoss ( const double  delta = 1.0,
const bool  mean = true 
)

Create the HuberLoss object.

Parameters
deltaThe threshold value upto which squared error is followed and after which absolute error is considered.
meanIf true then mean loss is computed otherwise sum.

Member Function Documentation

◆ Backward()

template<typename InputDataType , typename OutputDataType >
template<typename PredictionType , typename TargetType , typename LossType >
void mlpack::ann::HuberLoss< 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::HuberLoss< InputDataType, OutputDataType >::Forward ( const PredictionType &  prediction,
const TargetType &  target 
)

Computes the Huber Loss function.

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

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