de.jstacs.sequenceScores.statisticalModels.trainable.hmm.states.emissions
Interface Emission

All Superinterfaces:
Cloneable, Storable
All Known Subinterfaces:
DifferentiableEmission, SamplingEmission
All Known Implementing Classes:
AbstractConditionalDiscreteEmission, DiscreteEmission, GaussianEmission, MixtureEmission, MultivariateGaussianEmission, PhyloDiscreteEmission, PluginGaussianEmission, ReferenceSequenceDiscreteEmission, SilentEmission, UniformEmission

public interface Emission
extends Storable, Cloneable

This interface declares all method for an emission of a state.

Author:
Jens Keilwagen
See Also:
State

Method Summary
 void addToStatistic(boolean forward, int startPos, int endPos, double weight, Sequence seq)
          This method adds the weight to the internal sufficient statistic.
 void estimateFromStatistic()
          This method estimates the parameters from the internal sufficient statistic.
 AlphabetContainer getAlphabetContainer()
          This method returns the AlphabetContainer of this emission.
 double getLogPriorTerm()
          Returns a value that is proportional to the log of the prior.
 double getLogProbFor(boolean forward, int startPos, int endPos, Sequence seq)
          This method computes the logarithm of the likelihood.
 String getNodeLabel(double weight, String name, NumberFormat nf)
          Returns the graphviz label of the node containing this emission.
 String getNodeShape(boolean forward)
          Returns the graphviz string for the shape of the node.
 void initializeFunctionRandomly()
          This method initializes the emission randomly.
 void joinStatistics(Emission... emissions)
          This method joins the statistics of different instances and sets this joined statistic as statistic of each instance.
 void resetStatistic()
          This method resets the internal sufficient statistic.
 void setParameters(Emission t)
          Set values of parameters of the instance to the value of the parameters of the given instance.
 String toString(NumberFormat nf)
          This method returns a String representation of the instance.
 
Methods inherited from interface de.jstacs.Storable
toXML
 

Method Detail

getAlphabetContainer

AlphabetContainer getAlphabetContainer()
This method returns the AlphabetContainer of this emission.

Returns:
the AlphabetContainer of this emission

initializeFunctionRandomly

void initializeFunctionRandomly()
This method initializes the emission randomly.


getLogProbFor

double getLogProbFor(boolean forward,
                     int startPos,
                     int endPos,
                     Sequence seq)
                     throws OperationNotSupportedException
This method computes the logarithm of the likelihood.

Parameters:
forward - whether to use the forward or the reverse strand
startPos - the start position
endPos - the end position
seq - the sequence
Returns:
the logarithm of the probability
Throws:
OperationNotSupportedException - if forward=false and the reverse complement of the sequence seq is not defined

getLogPriorTerm

double getLogPriorTerm()
Returns a value that is proportional to the log of the prior. For maximum likelihood (ML) 0 should be returned.

Returns:
a value that is proportional to the log of the prior
See Also:
StatisticalModel.getLogPriorTerm()

resetStatistic

void resetStatistic()
This method resets the internal sufficient statistic.


addToStatistic

void addToStatistic(boolean forward,
                    int startPos,
                    int endPos,
                    double weight,
                    Sequence seq)
                    throws OperationNotSupportedException
This method adds the weight to the internal sufficient statistic.

Parameters:
forward - whether to use the forward or the reverse strand
startPos - the start position
endPos - the end position
weight - the weight of the sequence
seq - the sequence
Throws:
OperationNotSupportedException - if forward=false and the reverse complement of the sequence seq is not defined

joinStatistics

void joinStatistics(Emission... emissions)
This method joins the statistics of different instances and sets this joined statistic as statistic of each instance. This method might be used for instance in a multi-threaded optimization to join partial statistics.

Parameters:
emissions - the emissions to be joined

estimateFromStatistic

void estimateFromStatistic()
This method estimates the parameters from the internal sufficient statistic.


getNodeShape

String getNodeShape(boolean forward)
Returns the graphviz string for the shape of the node.

Parameters:
forward - if this emission is used on the forward strand
Returns:
the shape

getNodeLabel

String getNodeLabel(double weight,
                    String name,
                    NumberFormat nf)
Returns the graphviz label of the node containing this emission.

Parameters:
weight - the weight of the node which is represented by the color of the node, or -1 for no representation, i.e., white background
name - the name of the state using this emission
nf - the NumberFormat for formatting the textual representation of this emission
Returns:
the label

setParameters

void setParameters(Emission t)
                   throws IllegalArgumentException
Set values of parameters of the instance to the value of the parameters of the given instance. It can be assumed that the given instance and the current instance are from the same class. This method might be used for instance in a multi-threaded optimization to broadcast the parameters.

Parameters:
t - the emission with the parameters to be set
Throws:
IllegalArgumentException - if the assumption about the same class for given and current instance is wrong

toString

String toString(NumberFormat nf)
This method returns a String representation of the instance.

Parameters:
nf - the NumberFormat for the String representation of parameters or probabilities
Returns:
a String representation of the instance