ModErn Text Analysis
META Enumerates Textual Applications
|
The perceptron loss function for SGD algorithms. More...
#include <perceptron.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 = "perceptron" |
The identifier for this loss function. | |
The perceptron loss function for SGD algorithms.
Defined as \(\phi(p, y) = -py\) if \(py \leq 0\), 0 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.