ModErn Text Analysis
META Enumerates Textual Applications
Public Member Functions | Static Public Attributes | List of all members
meta::classify::loss::huber Struct Reference

The huber loss for SGD algorithms. More...

#include <huber.h>

Inheritance diagram for meta::classify::loss::huber:
meta::classify::loss::loss_function

Public Member Functions

double loss (double prediction, int expected) const override
 The loss incurred in assigning the given prediction value, given the correct value of the prediction. More...
 
double derivative (double prediction, int expected) const override
 The derivative of the loss function given a predicted value and the expected result of that prediction. More...
 

Static Public Attributes

static const std::string id = "huber"
 The identifier for this loss function.
 

Detailed Description

The huber loss for SGD algorithms.

Defined as \(\phi(p, y) = (p - y)^2\) when \(|p-y| \leq 1\) and \(\phi(p, y) = 2|p - y| - 1\) otherwise.

Member Function Documentation

double meta::classify::loss::huber::loss ( double  prediction,
int  expected 
) const
overridevirtual

The loss incurred in assigning the given prediction value, given the correct value of the prediction.

Parameters
predictionThe prediction obtained from the model (dot product)
expectedThe expected (as in, correct) value of the model's prediction
Returns
the loss incurred

Implements meta::classify::loss::loss_function.

double meta::classify::loss::huber::derivative ( double  prediction,
int  expected 
) const
overridevirtual

The derivative of the loss function given a predicted value and the expected result of that prediction.

Parameters
predictionThe prediction obtained from the model (dot product)
expectedThe expected (as in, correct) value of the model's prediction
Returns
the derivative of the loss function at that point

Implements meta::classify::loss::loss_function.


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