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

The modified huber loss function for SGD algorithms. More...

#include <modified_huber.h>

Inheritance diagram for meta::classify::loss::modified_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 = "modified-huber"
 The identifier for this loss function.
 

Detailed Description

The modified huber loss function for SGD algorithms.

Defined as \(\phi(p, y) = \max(0, 1 - py)^2\) when \(py \geq -1\) and \(\phi(p, y) = -4py\) otherwise.

Member Function Documentation

double meta::classify::loss::modified_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::modified_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: