ModErn Text Analysis
META Enumerates Textual Applications
huber.h
Go to the documentation of this file.
1 
9 #ifndef META_CLASSIFY_HUBER_LOSS_H_
10 #define META_CLASSIFY_HUBER_LOSS_H_
11 
12 #include <cmath>
14 
15 namespace meta
16 {
17 namespace classify
18 {
19 namespace loss
20 {
21 
28 struct huber : public loss_function
29 {
33  const static std::string id;
34 
35  double loss(double prediction, int expected) const override;
36  double derivative(double prediction, int expected) const override;
37 };
38 }
39 }
40 }
41 #endif
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: huber.cpp:17
static const std::string id
The identifier for this loss function.
Definition: huber.h:33
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: huber.cpp:25
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 huber loss for SGD algorithms.
Definition: huber.h:28