|
ModErn Text Analysis
META Enumerates Textual Applications
|
The least-squares loss function for SGD algorithms. More...
#include <least_squares.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 = "least-squares" |
| The identifier for this loss function. | |
The least-squares loss function for SGD algorithms.
Defined as \(\phi(p, y) = (p - y)^2\).
|
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.
1.8.9.1