Package jazzparser :: Package misc :: Package raphsto :: Class RaphstoHmmUnigram
[hide private]
[frames] | no frames]

Class RaphstoHmmUnigram

source code

                       object --+        
                                |        
utils.nltk.ngram.model.NgramModel --+    
                                    |    
                           RaphstoHmm --+
                                        |
                                       RaphstoHmmUnigram

Like RaphstoHmm, but always gives all state transitions equal probability, so that it is effectively a unigram model.

Train with jazzparser.misc.raphsto.train.RaphstoBaumWelchUnigramTrainer.

Instance Methods [hide private]
 
__init__(self, *args, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
transition_log_probability(self, state, previous_state)
Gives the probability P(label_i | label_(i-1), ..., label_(i-n)), where the previous labels are given in the sequence label_context.
source code
 
transition_probability(self, state, previous_state)
Wrapper for transition_log_probability to return a real probability.
source code

Inherited from RaphstoHmm: add_history, backoff_ngram, backward_log_probabilities, clear_cache, compute_gamma, compute_xi, delete, emission_log_probability, forward_log_probabilities, label, last_label_in_ngram, ngram_to_sequence, normal_backward_probabilities, normal_forward_probabilities, retrain_unsupervised, save, sequence_to_ngram, set_chord_transition_probabilities, to_picklable_dict

Inherited from RaphstoHmm (private): _get_my_filename

Inherited from utils.nltk.ngram.model.NgramModel: __repr__, backward_probabilities, decode_forward, decode_gamma, emission_probability, forward_backward_log_probabilities, forward_backward_probabilities, forward_probabilities, gamma_probabilities, generalized_viterbi, generate, get_all_ngrams, get_backoff_models, get_emission_matrix, get_transition_matrix, labeled_sequence_log_probability, normal_forward_backward_probabilities, precompute, transition_log_probability_debug, transition_probability_debug, viterbi_decode, viterbi_selector_probabilities

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

Class Methods [hide private]
 
_get_model_dir(cls) source code

Inherited from RaphstoHmm: from_picklable_dict, get_label_dom, initialize_chord_types, initialize_existing_model, list_models, load_model

Inherited from RaphstoHmm (private): _get_filename

Static Methods [hide private]
 
get_trainer() source code

Inherited from RaphstoHmm: train

Class Variables [hide private]

Inherited from RaphstoHmm: LABEL_DOM, V

Properties [hide private]

Inherited from RaphstoHmm (private): _filename

Inherited from utils.nltk.ngram.model.NgramModel: model_type

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args, **kwargs)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

transition_log_probability(self, state, previous_state)

source code 

Gives the probability P(label_i | label_(i-1), ..., label_(i-n)), where the previous labels are given in the sequence label_context. The context should be in reverse order, i.e. with the most recent label at the start.

Note that this is the probability of a label given the previous n-1 labels, which is the same as the probability of the n-gram [label_i, ..., label_(i-n+1)] given the ngram [label_(i-1), ..., label_(i-n)], since all but the last element of the ngram overlaps with the condition, so has probability 1.

Caches all computed transition probabilities. This is particularly important for backoff models. Many n-grams will back off to the same (n-1)-gram and we don't want to recompute the transition probability for that each time.

Overrides: utils.nltk.ngram.model.NgramModel.transition_log_probability
(inherited documentation)

transition_probability(self, state, previous_state)

source code 

Wrapper for transition_log_probability to return a real probability.

Overrides: utils.nltk.ngram.model.NgramModel.transition_probability
(inherited documentation)

get_trainer()
Static Method

source code 
Overrides: RaphstoHmm.get_trainer

_get_model_dir(cls)
Class Method

source code 
Overrides: RaphstoHmm._get_model_dir