Package jazzparser :: Package taggers :: Package ngram_multi :: Module tagger :: Class MultiChordNgramTaggerModel
[hide private]
[frames] | no frames]

Class MultiChordNgramTaggerModel

source code

        object --+    
                 |    
models.TaggerModel --+
                     |
                    MultiChordNgramTaggerModel

hash(x)

Instance Methods [hide private]
 
__init__(self, model_name, model=None, chordmap=None, *args, **kwargs)
An n-gram model to be used as a tagging model.
source code
 
train(self, sequences, 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_backward_probabilities(self, observations)
Returns a list of timesteps, each consisting of a dictionary mapping states to their occupation probability in that timestep.
source code
 
forward_probabilities(self, observations)
Like forward_backward_probabilities, but only uses forward algorithm.
source code
 
_get_readable_parameters(self)
Produce a human-readable repr of the params of the model
source code

Inherited from 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 models.TaggerModel: list_models, load_model

Inherited from models.TaggerModel (private): _get_model_dir

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-multi'
hash(x)
  TRAINING_OPTIONS = [ModuleOption('n', filter= int, help_text= ...
Properties [hide private]
  readable_parameters
Produce a human-readable repr of the params of the model

Inherited from models.TaggerModel: description, options

Inherited from models.TaggerModel (private): _filename

Inherited from object: __class__

Method Details [hide private]

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

source code 

An n-gram model to be used as a tagging model. Uses NLTK to represent, train and evaluate the n-gram model.

Overrides: object.__init__

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

source code 

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

Overrides: 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: 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: 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]

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