ModErn Text Analysis
META Enumerates Textual Applications
squared_hinge.h
Go to the documentation of this file.
1 
9 #ifndef META_CLASSIFY_SQUARED_HINGE_LOSS_H_
10 #define META_CLASSIFY_SQUARED_HINGE_LOSS_H_
11 
13 
14 namespace meta
15 {
16 namespace classify
17 {
18 namespace loss
19 {
20 
27 {
31  const static std::string id;
32 
33  double loss(double prediction, int expected) const override;
34  double derivative(double prediction, int expected) const override;
35 };
36 }
37 }
38 }
39 #endif
Base class for all loss functions that can be passed to the sgd classifier.
Definition: loss_function.h:29
The ModErn Text Analysis toolkit is a suite of natural language processing, classification, information retreival, data mining, and other applications of text processing.
Definition: analyzer.h:24
double loss(double prediction, int expected) const override
The loss incurred in assigning the given prediction value, given the correct value of the prediction...
Definition: squared_hinge.cpp:17
The squared hinge loss function for SGD algorithms.
Definition: squared_hinge.h:26
static const std::string id
The identifier for this loss function.
Definition: squared_hinge.h:31
double derivative(double prediction, int expected) const override
The derivative of the loss function given a predicted value and the expected result of that predictio...
Definition: squared_hinge.cpp:25