Table of Contents

Class: StateLabelHMM /amd/bernoulli/1/home/abt_vin/georgi/hmm/0.7/ghmm//ghmmwrapper/ghmm.py

Labelled HMMs with discrete emissions. Same feature list as in DiscreteEmission models.

Base Classes   
DiscreteEmissionHMM
Methods   
__init__
__str__
backwardLabels
baumWelchLabels
externalLabel
forwardLabels
getLabel
getLabels
gradientSearch
internalLabel
kbest
labelSeqLikelihoods
modelNormalize
sample
sampleSingle
setLabels
viterbiLabels
  __init__ 
__init__ (
        self,
        emissionDomain,
        distribution,
        labelDomain,
        cmodel,
        )

  __str__ 
__str__ ( self )

  backwardLabels 
backwardLabels (
        self,
        emissionSequence,
        labelSequence,
        scalingVector,
        )

Result: the (N x T)-matrix containing the backward-variables

Exceptions   
TypeError, "ERROR: Observation and Labellist must have same length"
TypeError, "EmissionSequence required, got " + str( emissionSequence.__class__.__name__ )
  baumWelchLabels 
baumWelchLabels (
        self,
        trainingSequences,
        nrSteps=None,
        loglikelihoodCutoff=None,
        )

Reestimates the model with the sequence in trainingSequences.

Note that training for models including silent states is not yet supported.

nrSteps is the maximal number of BW-steps loglikelihoodCutoff is the least relative improvement in likelihood with respect to the last iteration required to continue.

Exceptions   
TypeError, "EmissionSequence or SequenceSet required, got " + str( trainingSequences.__class__.__name__ )
  externalLabel 
externalLabel ( self,  internal )

Returns label representation of an int or list of int

Exceptions   
TypeError, 'int or list needed'
  forwardLabels 
forwardLabels (
        self,
        emissionSequence,
        labelSequence,
        )

Result: the (N x T)-matrix containing the forward-variables and the scaling vector

Exceptions   
TypeError, "ERROR: Observation and Labellist must have same length"
TypeError, "EmissionSequence required, got " + str( emissionSequence.__class__.__name__ )
  getLabel 
getLabel ( self,  stateIndex )

Returns label of the state stateIndex.

  getLabels 
getLabels ( self )

  gradientSearch 
gradientSearch (
        self,
        emissionsequences,
        eta=.1,
        steps=20,
        )

trains a model with given sequencesgradescentFunction using gradient descent

emission_sequences can either be a SequenceSet or an EmissionSequence

Exceptions   
TypeError, "LabeledEmissionSequence or LabeledSequenceSet required, got " + str( emissionsequences.__class__.__name__ )
  internalLabel 
internalLabel ( self,  external )

Return int representation of an label or list of labels

  kbest 
kbest (
        self,
        emissionSequences,
        k=1,
        )

Compute the k probable labeling for each sequence in emissionSequences

emissionSequences can either be a SequenceSet or an EmissionSequence

Result: [l_0, ..., l_T] the labeling of emissionSequences is an emmissionSequence object, [[l_0^0, ..., l_T^0], ..., [l_0^k, ..., l_T^k]} for a k-sequence SequenceSet

Exceptions   
TypeError, "EmissionSequence or SequenceSet required, got " + str( emissionSequences.__class__.__name__ )
  labelSeqLikelihoods 
labelSeqLikelihoods ( self,  emissionSequences )

Compute a vector ( log( P[s,l| model]) )_{s} of log-likelihoods of the individual emission_sequences using the forward algorithm

emission_sequences is of type SequenceSet

Result: log( P[emissionSequences,labels| model]) of type float (numarray) vector of floats

Exceptions   
TypeError, "EmissionSequence or SequenceSet required, got " + str( emissionSequences.__class__.__name__ )
  modelNormalize 
modelNormalize ( self )

  sample 
sample (
        self,
        seqNr,
        seqLength,
        seed=0,
        )

  sampleSingle 
sampleSingle (
        self,
        seqLength,
        seed=0,
        )

  setLabels 
setLabels ( self,  labelList )

Set the state labels to the values given in labelList. LabelList is in external representation.

Exceptions   
GHMMOutOfDomain, "Label " + str(labelList [ i ] ) + " not included in labelDomain."
  viterbiLabels 
viterbiLabels ( self,  emissionSequences )

Returns on approximation of the most likely labeling of the input sequence(s) as given by the viterbi path.

Exceptions   
TypeError, "EmissionSequence or SequenceSet required, got " + str( emissionSequences.__class__.__name__ )

Table of Contents

This document was automatically generated on Fri Jan 20 14:56:59 2006 by HappyDoc version WORKING