ModErn Text Analysis
META Enumerates Textual Applications
hinge.h
Go to the documentation of this file.
1 
9 #ifndef META_CLASSIFY_HINGE_LOSS_H_
10 #define META_CLASSIFY_HINGE_LOSS_H_
11 
12 #include <algorithm>
14 
15 namespace meta
16 {
17 namespace classify
18 {
19 namespace loss
20 {
21 
31 struct hinge : public loss_function
32 {
36  const static std::string id;
37 
38  double loss(double prediction, int expected) const override;
39  double derivative(double prediction, int expected) const override;
40 };
41 }
42 }
43 }
44 #endif
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: hinge.cpp:25
Base class for all loss functions that can be passed to the sgd classifier.
Definition: loss_function.h:29
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: hinge.cpp:17
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
The hinge loss for SGD algorithms.
Definition: hinge.h:31
static const std::string id
The identifier for this loss function.
Definition: hinge.h:36