ModErn Text Analysis
META Enumerates Textual Applications
|
The huber loss for SGD algorithms. More...
#include <huber.h>
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. | |
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.
|
overridevirtual |
The loss incurred in assigning the given prediction value, given the correct value of the prediction.
prediction | The prediction obtained from the model (dot product) |
expected | The expected (as in, correct) value of the model's prediction |
Implements meta::classify::loss::loss_function.
|
overridevirtual |
The derivative of the loss function given a predicted value and the expected result of that prediction.
prediction | The prediction obtained from the model (dot product) |
expected | The expected (as in, correct) value of the model's prediction |
Implements meta::classify::loss::loss_function.