Table of Contents

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

HMMs with discrete emissions. Optional features: - silent states - higher order states - parameter tying in training - background probabilities in training

Base Classes   
HMM
Methods   
__del__
__init__
__str__
applyBackground
assignAllBackgrounds
assignStateBackground
backwardTermination
baumWelch
extendDurations
getBackgroundAssignments
getSilentFlag
getTieGroups
isSilent
logprob
normalize
pathPosterior
posterior
removeTiegroups
setBackground
setEmission
setTieGroups
statePosterior
toMatrices
toXML
updateTieGroups
  __del__ 
__del__ ( self )

  __init__ 
__init__ (
        self,
        emissionDomain,
        distribution,
        cmodel,
        )

  __str__ 
__str__ ( self )

  applyBackground 
applyBackground ( self,  backgroundWeight )

Apply the background distribution to the emission probabilities of states which have been assigned one (usually in the editor and coded in the XML). applyBackground computes a convex combination of the emission probability and the background, where the backgroundWeight parameter (within [0,1]) controls the background's contribution for each state.

  assignAllBackgrounds 
assignAllBackgrounds ( self,  stateBackground )

Change all the assignments of background distributions to states.

Exceptions   
TypeError, "list required got " + str(type( stateBackground ) )
  assignStateBackground 
assignStateBackground (
        self,
        state,
        backgroundID,
        )

  backwardTermination 
backwardTermination (
        self,
        emissionSequence,
        pybeta,
        scalingVector,
        )

Result: the backward log probability of emissionSequence

Exceptions   
TypeError, "EmissionSequence required, got " + str( emissionSequence.__class__.__name__ )
  baumWelch 
baumWelch (
        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__ )
  extendDurations 
extendDurations ( self,  durationlist )

extend states with durations larger one this done by explicit state copying in C

  getBackgroundAssignments 
getBackgroundAssignments ( self )

  getSilentFlag 
getSilentFlag ( self,  state )

  getTieGroups 
getTieGroups ( self )

  isSilent 
isSilent ( self,  state )

Returns True if state is silent, False otherwise

  logprob 
logprob (
        self,
        emissionSequence,
        stateSequence,
        )

log P[ emissionSequence, stateSequence| m]

Exceptions   
SequenceCannotBeBuild, "first symbol " + str(emissionSequence [ i + 1 ] ) + " not emitted by state " + str(stateSequence [ 0 ] )
SequenceCannotBeBuild, "symbol " + str(emissionSequence [ i + 1 ] ) + " not emitted by state " + str(stateSequence [ i + 1 ] )
TypeError, "EmissionSequence required, got " + str( emissionSequence.__class__.__name__ )
  normalize 
normalize ( self )

Normalize transition probs, emission probs (if applicable)

  pathPosterior 
pathPosterior (
        self,
        sequence,
        path,
        )

Returns the log posterior probability for path having generated sequence.

CAVEAT: statePosterior needs to calculate the complete forward and backward matrices. If you are interested in multiple paths it would be more efficient to use the posterior function directly and not multiple calls to pathPosterior

Exceptions   
RuntimeError, "Models with silent states not yet supported."
  posterior 
posterior ( self,  sequence )

Posterior distribution matrix for sequence.

Exceptions   
RuntimeError, "Models with silent states not yet supported."
  removeTiegroups 
removeTiegroups ( self )

  setBackground 
setBackground (
        self,
        backgroundObject,
        stateBackground,
        )

Configure model to use the background distributions in backgroundObject. stateBackground is a list of indixes (one for each state) refering to distributions in backgroundObject.

Note: values in backgroundObject are deepcopied into model

Exceptions   
TypeError, "BackgroundDistribution required, got " + str( emissionSequences.__class__.__name__ )
TypeError, "list required got " + str(type( stateBackground ) )
  setEmission 
setEmission (
        self,
        i,
        distributionParameters,
        )

Set the emission distribution parameters for a discrete model.

  setTieGroups 
setTieGroups ( self,  tieList )

  statePosterior 
statePosterior (
        self,
        sequence,
        state,
        time,
        )

Return the log posterior probability for being at state at time time in sequence.

CAVEAT: statePosterior needs to calculate the complete forward and backward matrices. If you are interested in multiple states it would be more efficient to use the posterior function directly and not multiple calls to statePosterior

Exceptions   
RuntimeError, "Models with silent states not yet supported."
  toMatrices 
toMatrices ( self )

Return the parameters in matrix form.

  toXML 
toXML (
        self,
        filename,
        backgroundobj=None,
        )

  updateTieGroups 
updateTieGroups ( self )


Table of Contents

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