ModErn Text Analysis
META Enumerates Textual Applications
perceptron.h
1 
9 #ifndef META_SEQUENCE_PERCEPTRON_H_
10 #define META_SEQUENCE_PERCEPTRON_H_
11 
12 #include <random>
13 
16 
17 namespace meta
18 {
19 namespace sequence
20 {
21 
26 {
27  public:
32  {
36  uint64_t max_iterations = 5;
37 
42  std::random_device::result_type seed = std::random_device{}();
43  };
44 
48  perceptron();
49 
54  perceptron(const std::string& prefix);
55 
61  void tag(sequence& seq) const;
62 
71  void train(std::vector<sequence>& sequences,
72  const training_options& options);
73 
80  void save(const std::string& prefix) const;
81 
82  private:
87 
92 };
93 }
94 }
95 
96 #endif
A greedy averaged perceptron tagger.
Definition: perceptron.h:25
Represents a tagged sequence of observations.
Definition: sequence.h:24
uint64_t max_iterations
How many iterations should the training algorithm run?
Definition: perceptron.h:36
perceptron()
Default constructor.
Definition: perceptron.cpp:22
void tag(sequence &seq) const
Tags a sequence.
Definition: perceptron.cpp:61
void save(const std::string &prefix) const
Saves the model to the folder specified by prefix.
Definition: perceptron.cpp:145
classify::linear_model< feature_id, double, label_id > model_
The model storage.
Definition: perceptron.h:91
std::random_device::result_type seed
The seed for the random number generator used for shuffling examples during training.
Definition: perceptron.h:42
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
Training options required for learning a tagger.
Definition: perceptron.h:31
void train(std::vector< sequence > &sequences, const training_options &options)
Trains the tagger on a set of sequences using the given options.
Definition: perceptron.cpp:71
Analyzer that operates over sequences, generating features based on a set of "observation functions"...
Definition: sequence_analyzer.h:49
sequence_analyzer analyzer_
The analyzer used for feature generation.
Definition: perceptron.h:86