ModErn Text Analysis
META Enumerates Textual Applications
binary_classifier.h
Go to the documentation of this file.
1 
9 #ifndef META_BINARY_CLASSIFIER_H_
10 #define META_BINARY_CLASSIFIER_H_
11 
13 
14 namespace meta
15 {
16 namespace classify
17 {
18 
25 {
26  public:
38  binary_classifier(std::shared_ptr<index::forward_index> idx,
39  class_label positive, class_label negative);
40 
48  class_label classify(doc_id d_id) final;
49 
54  virtual double predict(doc_id d_id) const = 0;
55 
59  const class_label& positive_label() const;
60 
64  const class_label& negative_label() const;
65 
66  private:
70  const class_label positive_;
71 
75  const class_label negative_;
76 };
77 
78 }
79 }
80 #endif
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
A classifier uses a document's feature space to identify which group it belongs to.
Definition: classifier.h:24
virtual double predict(doc_id d_id) const =0
const class_label negative_
The label to return when an example is classified as "negative".
Definition: binary_classifier.h:75
const class_label & negative_label() const
Definition: binary_classifier.cpp:33
binary_classifier(std::shared_ptr< index::forward_index > idx, class_label positive, class_label negative)
Creates a new binary classifier using the given index to retrieve documents, treating anything with t...
Definition: binary_classifier.cpp:13
class_label classify(doc_id d_id) final
Classifies a document into a specific group, as determined by training data.
Definition: binary_classifier.cpp:22
const class_label positive_
The label that marks positive examples.
Definition: binary_classifier.h:70
const class_label & positive_label() const
Definition: binary_classifier.cpp:28
A classifier which classifies documents as "positive" or "negative".
Definition: binary_classifier.h:24