ModErn Text Analysis
META Enumerates Textual Applications
Classes | Public Member Functions | Private Attributes | List of all members
meta::sequence::perceptron Class Reference

A greedy averaged perceptron tagger. More...

#include <perceptron.h>

Classes

struct  training_options
 Training options required for learning a tagger. More...
 

Public Member Functions

 perceptron ()
 Default constructor.
 
 perceptron (const std::string &prefix)
 Loads a perceptron tagger from a given prefix. More...
 
void tag (sequence &seq) const
 Tags a sequence. More...
 
void train (std::vector< sequence > &sequences, const training_options &options)
 Trains the tagger on a set of sequences using the given options. More...
 
void save (const std::string &prefix) const
 Saves the model to the folder specified by prefix. More...
 

Private Attributes

sequence_analyzer analyzer_
 The analyzer used for feature generation.
 
classify::linear_model< feature_id, double, label_id > model_
 The model storage.
 

Detailed Description

A greedy averaged perceptron tagger.

Constructor & Destructor Documentation

meta::sequence::perceptron::perceptron ( const std::string &  prefix)

Loads a perceptron tagger from a given prefix.

Parameters
prefixThe folder that contains the tagger model

Member Function Documentation

void meta::sequence::perceptron::tag ( sequence seq) const

Tags a sequence.

This sets both the label and tag of the sequence's observations.

Parameters
seqThe sequence to be tagged
void meta::sequence::perceptron::train ( std::vector< sequence > &  sequences,
const training_options options 
)

Trains the tagger on a set of sequences using the given options.

The sequences given for training will be analyzed by the tagger internally, so they do not need to be analyzed ahead of time.

Parameters
sequencesThe training data
optionsTHe training options
void meta::sequence::perceptron::save ( const std::string &  prefix) const

Saves the model to the folder specified by prefix.

Both the tagger and its analyzer are serialized.

Parameters
prefixThe folder to save the model to

The documentation for this class was generated from the following files: