ModErn Text Analysis
META Enumerates Textual Applications
loss_function.h
Go to the documentation of this file.
1 
9 #ifndef META_CLASSIFY_LOSS_FUNCTION_H_
10 #define META_CLASSIFY_LOSS_FUNCTION_H_
11 
12 #include <string>
13 
14 namespace meta
15 {
16 namespace classify
17 {
18 namespace loss
19 {
20 
30 {
41  virtual double loss(double prediction, int expected) const = 0;
42 
53  virtual double derivative(double prediction, int expected) const = 0;
54 };
55 }
56 }
57 }
58 #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
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 predictio...
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...