Package jazzparser :: Package backoff :: Package ngram :: Module hmmpath :: Class HmmPathModel
[hide private]
[frames] | no frames]

Class HmmPathModel

source code

                object --+        
                         |        
taggers.models.TaggerModel --+    
                             |    
             base.BackoffModel --+
                                 |
                                HmmPathModel

Model type that uses an ngram model to assign a tonal space path to a sequence. This class provides the interface to the model training and decoding. The details are all implemented in the model class above.

Instance Methods [hide private]
 
__init__(self, model_name, model=None, grammar=None, *args, **kwargs)
Creates an empty, untrained model.
source code
 
train(self, data, grammar=None, logger=None)
Trains the loaded model using the data in the list of sequences.
source code
 
_get_model_data(self)
Subclasses should implement this method to return the raw data of the model in a form that can be pickled and written out to a file.
source code
 
forward_probabilities(self, sequence)
Interface to the NgramModel's forward_probabilities
source code
 
forward_backward_probabilities(self, sequence) source code
 
viterbi_probabilities(self, sequence) source code
 
viterbi_paths(self, sequence, paths=None) source code
 
_get_labels(self) source code
 
_get_readable_parameters(self)
Produce a human-readable repr of the params of the model
source code

Inherited from taggers.models.TaggerModel: delete, get_extra_filenames, process_training_options, save

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]

Inherited from base.BackoffModel (private): _get_model_dir

Inherited from taggers.models.TaggerModel: list_models, load_model

Static Methods [hide private]
 
_load_model(data)
Subclasses should implement this method to load up the model data given in the argument data.
source code
Class Variables [hide private]
  MODEL_TYPE = 'ngram'
hash(x)
  TRAINING_OPTIONS = [ModuleOption('n', filter= int, help_text= ...
Properties [hide private]
  labels
  readable_parameters
Produce a human-readable repr of the params of the model

Inherited from taggers.models.TaggerModel: description, options

Inherited from taggers.models.TaggerModel (private): _filename

Inherited from object: __class__

Method Details [hide private]

__init__(self, model_name, model=None, grammar=None, *args, **kwargs)
(Constructor)

source code 

Creates an empty, untrained model. To load a previously stored model, use from_file().

Optionally stores some custom descriptive text. This will be included in the descriptive text that gets stored along with the model.

Overrides: object.__init__
(inherited documentation)

train(self, data, grammar=None, logger=None)

source code 

Trains the loaded model using the data in the list of sequences.

Overrides: taggers.models.TaggerModel.train
(inherited documentation)

_load_model(data)
Static Method

source code 

Subclasses should implement this method to load up the model data given in the argument data. They should return an instance of themselves. The data will be in the form of a dictionary, as returned by the class' _get_model_data().

A default implementation that just uses simple pickling is provided. It assumes that the class can be instantiated using no arguments.

Overrides: taggers.models.TaggerModel._load_model
(inherited documentation)

_get_model_data(self)

source code 

Subclasses should implement this method to return the raw data of the model in a form that can be pickled and written out to a file.

A default implementation to complement the implementation of _load_model is provided.

*** IMPORTANT: *** Some implementations perform part of the model storage in their _get_model_data method, so you shouldn't use this just to get the data if you don't plan to store it. (Not sure why you'd want the raw data anyway and this is a private method - just warning you!)

Overrides: taggers.models.TaggerModel._get_model_data
(inherited documentation)

Class Variable Details [hide private]

TRAINING_OPTIONS

Value:
[ModuleOption('n', filter= int, help_text= "Length of the n-grams whic\
h this model will use.", usage= "n=N, where N is an integer. Defaults \
to bigrams", default= 2), ModuleOption('backoff', filter= int, help_te\
xt= "Number of orders of backoff to use. This must be " "less than n. \
E.g. if using a trigram model (n=3) you can " "set backoff=2 to back o\
ff to bigrams and from bigrams " "to unigrams. Set to 0 to use no back\
off at all (default).", usage= "backoff=X, where X is an integer < n",\
 default= 0), ModuleOption('cutoff', filter= int, help_text= "In estim\
...

Property Details [hide private]

labels

Get Method:
_get_labels(self)

readable_parameters

Produce a human-readable repr of the params of the model

Get Method:
_get_readable_parameters(self) - Produce a human-readable repr of the params of the model