ModErn Text Analysis
META Enumerates Textual Applications
|
Base class for all loss functions that can be passed to the sgd classifier. More...
#include <loss_function.h>
Public Member Functions | |
virtual double | loss (double prediction, int expected) const =0 |
The loss incurred in assigning the given prediction value, given the correct value of the prediction. More... | |
virtual double | derivative (double prediction, int expected) const =0 |
The derivative of the loss function given a predicted value and the expected result of that prediction. More... | |
Base class for all loss functions that can be passed to the sgd classifier.
Each loss function must specify the value of the loss for a given prediction vs. expected value, and also the derivative of the loss function for a given prediction vs. expected value.
|
pure virtual |
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 |
Implemented in meta::classify::loss::hinge, meta::classify::loss::huber, meta::classify::loss::logistic, meta::classify::loss::modified_huber, meta::classify::loss::smooth_hinge, meta::classify::loss::least_squares, meta::classify::loss::perceptron, and meta::classify::loss::squared_hinge.
|
pure virtual |
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 |
Implemented in meta::classify::loss::hinge, meta::classify::loss::huber, meta::classify::loss::logistic, meta::classify::loss::modified_huber, meta::classify::loss::smooth_hinge, meta::classify::loss::least_squares, meta::classify::loss::perceptron, and meta::classify::loss::squared_hinge.