ModErn Text Analysis
META Enumerates Textual Applications
Public Member Functions | List of all members
meta::classify::loss::loss_function Struct Referenceabstract

Base class for all loss functions that can be passed to the sgd classifier. More...

#include <loss_function.h>

Inheritance diagram for meta::classify::loss::loss_function:
meta::classify::loss::hinge meta::classify::loss::huber meta::classify::loss::least_squares meta::classify::loss::logistic meta::classify::loss::modified_huber meta::classify::loss::perceptron meta::classify::loss::smooth_hinge meta::classify::loss::squared_hinge

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...
 

Detailed Description

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.

See also
http://dl.acm.org/citation.cfm?id=1015332

Member Function Documentation

virtual double meta::classify::loss::loss_function::loss ( double  prediction,
int  expected 
) const
pure virtual

The loss incurred in assigning the given prediction value, given the correct value of the prediction.

Parameters
predictionThe prediction obtained from the model (dot product)
expectedThe expected (as in, correct) value of the model's prediction
Returns
the loss incurred

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.

virtual double meta::classify::loss::loss_function::derivative ( double  prediction,
int  expected 
) const
pure virtual

The derivative of the loss function given a predicted value and the expected result of that prediction.

Parameters
predictionThe prediction obtained from the model (dot product)
expectedThe expected (as in, correct) value of the model's prediction
Returns
the derivative of the loss function at that point

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.


The documentation for this struct was generated from the following file: