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

Public Member Functions

 HuberLoss (const double delta=1.0, const bool mean=true)
 Create the HuberLoss object. 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...

 
double Delta () const
 Get the value of delta. More...

 
double & Delta ()
 Set the value of delta. More...

 
template
<
typename
PredictionType
,
typename
TargetType
>
PredictionType::elem_type Forward (const PredictionType &prediction, const TargetType &target)
 Computes the Huber Loss function. More...

 
bool Mean () const
 Get the value of reduction type. More...

 
bool & Mean ()
 Set the value of reduction type. 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 layer. More...

 

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

Definition at line 36 of file huber_loss.hpp.

Constructor & Destructor Documentation

◆ HuberLoss()

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

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.

◆ Delta() [1/2]

double Delta ( ) const
inline

Get the value of delta.

Definition at line 78 of file huber_loss.hpp.

◆ Delta() [2/2]

double& Delta ( )
inline

Set the value of delta.

Definition at line 80 of file huber_loss.hpp.

◆ Forward()

PredictionType::elem_type Forward ( const PredictionType &  prediction,
const TargetType &  target 
)

Computes the Huber Loss function.

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

◆ Mean() [1/2]

bool Mean ( ) const
inline

Get the value of reduction type.

Definition at line 83 of file huber_loss.hpp.

◆ Mean() [2/2]

bool& Mean ( )
inline

Set the value of reduction type.

Definition at line 85 of file huber_loss.hpp.

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

◆ OutputParameter() [1/2]

OutputDataType& OutputParameter ( ) const
inline

Get the output parameter.

Definition at line 73 of file huber_loss.hpp.

◆ OutputParameter() [2/2]

OutputDataType& OutputParameter ( )
inline

Modify the output parameter.

Definition at line 75 of file huber_loss.hpp.

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t   
)

Serialize the layer.

Referenced by HuberLoss< InputDataType, OutputDataType >::Mean().


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/huber_loss.hpp