Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.jstacs.models.hmm.transitions.elements
Class ReferenceBasedTransitionElement

    java.lang.Object
      de.jstacs.models.hmm.transitions.BasicHigherOrderTransition.AbstractTransitionElement
          de.jstacs.models.hmm.transitions.elements.BasicTransitionElement
              de.jstacs.models.hmm.transitions.elements.ReferenceBasedTransitionElement

All Implemented Interfaces:
  Storable, Cloneable

Direct Known Subclasses:
  DistanceBasedScaledTransitionElement, ScaledTransitionElement

    public class ReferenceBasedTransitionElement

extends BasicTransitionElement

This class implements transition elements that utilize a reference sequence to determine the transition probability. The reference sequence is given as annotation of the original sequence and can be utilized using `annotationID`.

Author:
  Jens Keilwagen, Michael Seifert
See Also:
  `ReferenceSequenceAnnotation`

Field Summary
`protected String` | `annotationID` The annotation id used for determining the transition matrix from the `ReferenceSequenceAnnotation`s.
`protected int` | `diagElement` The index of the self transition.
`protected double` | `ess` The equivalent sample size (ess) used in the prior of this instance.
`protected double[]` | `probabilities` Represents the initial the transition probabilities.
`protected double[][]` | `statisticsTransitionProb` Represents the gammas required for estimating the transition probabilities not including pseudocounts.

Fields inherited from class de.jstacs.models.hmm.transitions.BasicHigherOrderTransition.AbstractTransitionElement
`context, descendants, hyperParameters, logNorm, parameters, states, statistic`

Constructor Summary
`ReferenceBasedTransitionElement(int[] context, int[] states, double ess, double[] probabilities, String annotationID)` Creates an `ReferenceBasedTransitionElement` representing a conditional transition probability distribution of a Hidden Markov Model for the given context.
`ReferenceBasedTransitionElement(int[] context, int[] states, double ess, double[] probabilities, String annotationID, double[] weight)` Creates an `ReferenceBasedTransitionElement` representing a conditional transition probability distribution of a Hidden Markov Model for the given context.
`ReferenceBasedTransitionElement(StringBuffer xml)` The standard constructor for the interface `Storable`.

Method Summary
`protected void` | `appendFurtherInformation(StringBuffer xml)` This method appends further information to the XML representation.
`ReferenceBasedTransitionElement` | `clone()`
`protected void` | `determineDiagonalElement()` This method determines the self transition.
`protected void` | `extractFurtherInformation(StringBuffer xml)` This method extracts further information from the XML representation.
`double` | `getLogGammaScoreFromStatistic()` This method calculates a score for the current statistics, which is independent from the current parameters In general the gamma-score is a product of gamma-functions parameterized with the current statistics
`double` | `getLogPriorTerm()` Returns a value that is proportional to the log of the prior.
`protected void` | `init()` This method initializes internal fields.
`void` | `initializeRandomly()` This method draws new parameters from the prior.
`protected void` | `precompute()` This method precomputes internal fields as for instance the normalization constant.

Methods inherited from class de.jstacs.models.hmm.transitions.BasicHigherOrderTransition.AbstractTransitionElement
`addToStatistic, appendGraphvizDescription, appendTransitions, drawParametersFromStatistic, estimateFromStatistic, getArrowOption, getChild, getContext, getDescendant, getGraphvizEdgeWeight, getLabel, getLogScoreFor, getNextContext, getNumberOfChildren, getNumberOfParameters, getXMLTag, resetStatistic, setIndexOfDescendantTransitionElement, toString, toString, toXML`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### annotationID

    protected String annotationID

  The annotation id used for determining the transition matrix from the `ReferenceSequenceAnnotation`s.

### probabilities

    protected double[] probabilities

  Represents the initial the transition probabilities.

### statisticsTransitionProb

    protected double[][] statisticsTransitionProb

  Represents the gammas required for estimating the transition probabilities not including pseudocounts.

### ess

    protected double ess

  The equivalent sample size (ess) used in the prior of this instance.

### diagElement

    protected int diagElement

  The index of the self transition.

Constructor Detail

### ReferenceBasedTransitionElement

    public ReferenceBasedTransitionElement(int[] context,
                                           int[] states,
                                           double ess,
                                           double[] probabilities,
                                           String annotationID)

  Creates an `ReferenceBasedTransitionElement` representing a conditional transition probability distribution of a Hidden Markov Model for the given context.

  Parameters:
    `context` - context of states
    `states` - states that can be reached from the context
    `probabilities` - transition probabilities from the context to the states
    `ess` - the equivalent sample size (ess)
    `annotationID` - identifier for decoding transition classes
  See Also:
    `ReferenceBasedTransitionElement(int[], int[], double, double[], String, double[])`

### ReferenceBasedTransitionElement

    public ReferenceBasedTransitionElement(int[] context,
                                           int[] states,
                                           double ess,
                                           double[] probabilities,
                                           String annotationID,
                                           double[] weight)

  Creates an `ReferenceBasedTransitionElement` representing a conditional transition probability distribution of a Hidden Markov Model for the given context.

  Parameters:
    `context` - context of states
    `states` - states that can be reached from the context
    `probabilities` - transition probabilities from the context to the states
    `ess` - the equivalent sample size (ess)
    `annotationID` - identifier for decoding transition classes
    `weight` - the weight for plotting the edge in Graphviz, enables to modify the edge length, larger weights imply shorter edges (default: 1)

### ReferenceBasedTransitionElement

    public ReferenceBasedTransitionElement(StringBuffer xml)
                                    throws NonParsableException

  The standard constructor for the interface `Storable`. Constructs a `ReferenceBasedTransitionElement` out of an XML representation.

  Parameters:
    `xml` - the XML representation as `StringBuffer`
  Throws:
    `NonParsableException` - if the `ReferenceBasedTransitionElement` could not be reconstructed out of the `StringBuffer` `xml`

Method Detail

### init

    protected void init()

  Description copied from class: `BasicHigherOrderTransition.AbstractTransitionElement`
  This method initializes internal fields.

  Overrides:
    `init` in class `BasicHigherOrderTransition.AbstractTransitionElement`

### clone

    public ReferenceBasedTransitionElement clone()
                                          throws CloneNotSupportedException

  Overrides:
    `clone` in class `BasicHigherOrderTransition.AbstractTransitionElement`
  Throws:
    `CloneNotSupportedException`

### determineDiagonalElement

    protected void determineDiagonalElement()

  This method determines the self transition.

  See Also:
    `diagElement`

### precompute

    protected void precompute()

  Description copied from class: `BasicHigherOrderTransition.AbstractTransitionElement`
  This method precomputes internal fields as for instance the normalization constant.

  Overrides:
    `precompute` in class `BasicHigherOrderTransition.AbstractTransitionElement`
  See Also:
    `BasicHigherOrderTransition.AbstractTransitionElement.logNorm`

### getLogPriorTerm

    public double getLogPriorTerm()

  Description copied from class: `BasicHigherOrderTransition.AbstractTransitionElement`
  Returns a value that is proportional to the log of the prior. For maximum likelihood (ML) 0 should be returned.

  Overrides:
    `getLogPriorTerm` in class `BasicHigherOrderTransition.AbstractTransitionElement`
  Returns:
    a value that is proportional to the log of the prior
  See Also:
    `Transition.getLogPriorTerm()`

### getLogGammaScoreFromStatistic

    public double getLogGammaScoreFromStatistic()

  Description copied from class: `BasicHigherOrderTransition.AbstractTransitionElement`
  This method calculates a score for the current statistics, which is independent from the current parameters In general the gamma-score is a product of gamma-functions parameterized with the current statistics

  Overrides:
    `getLogGammaScoreFromStatistic` in class `BasicHigherOrderTransition.AbstractTransitionElement`
  Returns:
    the logarithm of the gamma-score for the current statistics

### initializeRandomly

    public void initializeRandomly()

  Description copied from class: `BasicHigherOrderTransition.AbstractTransitionElement`
  This method draws new parameters from the prior.

  Overrides:
    `initializeRandomly` in class `BasicHigherOrderTransition.AbstractTransitionElement`

### appendFurtherInformation

    protected void appendFurtherInformation(StringBuffer xml)

  Description copied from class: `BasicHigherOrderTransition.AbstractTransitionElement`
  This method appends further information to the XML representation. It allows subclasses to save further parameters that are not defined in the superclass.

  Overrides:
    `appendFurtherInformation` in class `BasicTransitionElement`
  Parameters:
    `xml` - the XML representation

### extractFurtherInformation

    protected void extractFurtherInformation(StringBuffer xml)
                                      throws NonParsableException

  Description copied from class: `BasicHigherOrderTransition.AbstractTransitionElement`
  This method extracts further information from the XML representation. It allows subclasses to cast further parameters that are not defined in the superclass.

  Overrides:
    `extractFurtherInformation` in class `BasicTransitionElement`
  Parameters:
    `xml` - the XML representation
  Throws:
    `NonParsableException` - if the information could not be reconstructed out of the `StringBuffer` `xml`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD