ModErn Text Analysis
META Enumerates Textual Applications
perceptron.h
1 
9 #ifndef META_CLASSIFY_PERCEPTRON_LOSS_H_
10 #define META_CLASSIFY_PERCEPTRON_LOSS_H_
11 
13 
14 namespace meta
15 {
16 namespace classify
17 {
18 namespace loss
19 {
20 
26 struct perceptron : public loss_function
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
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: perceptron.cpp:24
The perceptron loss function for SGD algorithms.
Definition: perceptron.h:26
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: perceptron.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
static const std::string id
The identifier for this loss function.
Definition: perceptron.h:31