de.jstacs.sequenceScores.statisticalModels.trainable.hmm.models
Class SamplingPhyloHMM

java.lang.Object
  extended by de.jstacs.sequenceScores.statisticalModels.trainable.AbstractTrainableStatisticalModel
      extended by de.jstacs.sequenceScores.statisticalModels.trainable.hmm.AbstractHMM
          extended by de.jstacs.sequenceScores.statisticalModels.trainable.hmm.models.HigherOrderHMM
              extended by de.jstacs.sequenceScores.statisticalModels.trainable.hmm.models.SamplingHigherOrderHMM
                  extended by de.jstacs.sequenceScores.statisticalModels.trainable.hmm.models.SamplingPhyloHMM
All Implemented Interfaces:
SequenceScore, StatisticalModel, TrainableStatisticalModel, Storable, Cloneable

public class SamplingPhyloHMM
extends SamplingHigherOrderHMM

This class implements an (higher order) HMM that contains multi-dimensional emissions described by a phylogenetic tree. The model is trained by a Metropolis-Hastings algorithm.

Author:
Michael Scharfe

Nested Class Summary
 
Nested classes/interfaces inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.hmm.models.SamplingHigherOrderHMM
SamplingHigherOrderHMM.ViterbiComputation
 
Nested classes/interfaces inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.hmm.models.HigherOrderHMM
HigherOrderHMM.Type
 
Field Summary
 
Fields inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.hmm.models.SamplingHigherOrderHMM
burnInTest, hasSampled
 
Fields inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.hmm.models.HigherOrderHMM
backwardIntermediate, container, logEmission, numberOfSummands, skipInit, stateList
 
Fields inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.hmm.AbstractHMM
bwdMatrix, emission, emissionIdx, finalState, forward, fwdMatrix, name, sostream, START_NODE, states, threads, trainingParameter, transition
 
Fields inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.AbstractTrainableStatisticalModel
alphabets, length
 
Constructor Summary
SamplingPhyloHMM(SamplingHMMTrainingParameterSet trainingParameterSet, String[] name, int[] emissionIdx, boolean[] forward, PhyloDiscreteEmission[] emission, TransitionElement... te)
          This is the main constructor for a hidden markov model with phylogenetic emission(s) This model can be trained using a metropolis hastings algorithm
SamplingPhyloHMM(StringBuffer xml)
          The standard constructor for the interface Storable.
 
Method Summary
 String getInstanceName()
          Should return a short instance name such as iMM(0), BN(2), ...
protected  void getNewParameters()
          This method set all parameters for the next sampling step
 
Methods inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.hmm.models.SamplingHigherOrderHMM
acceptParameters, appendFurtherInformation, clone, createStates, drawFromStatistics, extractFurtherInformation, furtherInits, getLogPosteriorFromStatistic, getLogProbForPath, getLogStatePosteriorMatrixFor, getViterbiPath, getViterbiPathFor, getXMLTag, gibbsSampling, gibbsSamplingStep, initTraining, isInitialized, logProb, parseNextParameterSet, parseParameterSet, train
 
Methods inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.hmm.models.HigherOrderHMM
baumWelch, createHelperVariables, estimateFromStatistics, fillBwdMatrix, fillBwdOrViterbiMatrix, fillFwdMatrix, fillLogStatePosteriorMatrix, finalize, getCharacteristics, getLogPriorTerm, getLogScoreFor, getLogScoreFor, getMaximalMarkovOrder, getNumericalCharacteristics, initialize, initializeRandomly, resetStatistics, samplePath, viterbi
 
Methods inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.hmm.AbstractHMM
createMatrixForStatePosterior, decodePath, decodeStatePosterior, determineFinalStates, fromXML, getFinalStatePosterioriMatrix, getGraphvizRepresentation, getGraphvizRepresentation, getGraphvizRepresentation, getGraphvizRepresentation, getLogProbFor, getLogStatePosteriorMatrixFor, getNumberOfStates, getNumberOfThreads, getRunTimeException, getStatePosteriorMatrixFor, getStatePosteriorMatrixFor, getViterbiPathFor, getViterbiPathsFor, initTransition, provideMatrix, setOutputStream, toString, toXML, train
 
Methods inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.AbstractTrainableStatisticalModel
check, emitDataSet, getAlphabetContainer, getLength, getLogProbFor, getLogProbFor, getLogScoreFor, getLogScoreFor, getLogScoreFor, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SamplingPhyloHMM

public SamplingPhyloHMM(SamplingHMMTrainingParameterSet trainingParameterSet,
                        String[] name,
                        int[] emissionIdx,
                        boolean[] forward,
                        PhyloDiscreteEmission[] emission,
                        TransitionElement... te)
                 throws CloneNotSupportedException,
                        IllegalArgumentException,
                        WrongAlphabetException,
                        Exception
This is the main constructor for a hidden markov model with phylogenetic emission(s) This model can be trained using a metropolis hastings algorithm

Parameters:
trainingParameterSet - the ParameterSet that determines the training algorithm and contains the necessary Parameters
name - the names of the states
emissionIdx - the indices of the emissions that should be used for each state
forward - a boolean array that indicates whether the symbol on the forward or the reverse complementary strand should be used
emission - the emissions
te - the TransitionElements building a transition
Throws:
CloneNotSupportedException - if the parameters or the emissions or transition elements could not be cloned
IllegalArgumentException - if one of the parameters is not allowed
WrongAlphabetException - if the alphabet does not fit the model
Exception - if something else went wrong

SamplingPhyloHMM

public SamplingPhyloHMM(StringBuffer xml)
                 throws NonParsableException
The standard constructor for the interface Storable. Constructs an SamplingPhyloHMM out of an XML representation.

Parameters:
xml - the XML representation as StringBuffer
Throws:
NonParsableException - if the SamplingPhyloHMM could not be reconstructed out of the StringBuffer xml
Method Detail

getInstanceName

public String getInstanceName()
Description copied from interface: SequenceScore
Should return a short instance name such as iMM(0), BN(2), ...

Specified by:
getInstanceName in interface SequenceScore
Overrides:
getInstanceName in class SamplingHigherOrderHMM
Returns:
a short instance name

getNewParameters

protected void getNewParameters()
                         throws Exception
Description copied from class: SamplingHigherOrderHMM
This method set all parameters for the next sampling step

Overrides:
getNewParameters in class SamplingHigherOrderHMM
Throws:
Exception - if something went wrong