ModErn Text Analysis
META Enumerates Textual Applications
|
The smooth hinge loss function for SGD algorithms. More...
#include <smooth_hinge.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 = "smooth-hinge" |
The identifier for this loss function. | |
The smooth hinge loss function for SGD algorithms.
Defined as \(\phi(p, y) = \frac12 \max(0, 1 - py)^2\) if \(py \geq 0\) and \(\phi(p, y) = \frac12 - py\) 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.