|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.sequenceScores.statisticalModels.trainable.hmm.states.emissions.discrete.AbstractConditionalDiscreteEmission
de.jstacs.sequenceScores.statisticalModels.trainable.hmm.states.emissions.discrete.DiscreteEmission
de.jstacs.sequenceScores.statisticalModels.trainable.hmm.states.emissions.discrete.PhyloDiscreteEmission
public class PhyloDiscreteEmission
Phylogenetic discrete emission This class uses a phylogenetic tree to describe multidimensional data It implements Felsensteins model for nucleotide substitution (F81)
Field Summary |
---|
Fields inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.hmm.states.emissions.discrete.AbstractConditionalDiscreteEmission |
---|
con, counter, ess, grad, hyperParams, logNorm, offset, params, paramsFile, probs, reader, samplingIndex, statistic, writer |
Constructor Summary | |
---|---|
PhyloDiscreteEmission(AlphabetContainer con,
double[] hyperParams,
PhyloTree t)
This is a simple constructor for a DiscreteEmission defining the individual hyper parameters. |
|
PhyloDiscreteEmission(AlphabetContainer con,
double ess,
PhyloTree t)
This is a simple constructor for a PhyloDiscreteEmission based on the equivalent sample size. |
Method Summary | |
---|---|
void |
addGradientOfLogPriorTerm(double[] gradient,
int offset)
This method computes the gradient of Emission.getLogPriorTerm() for each
parameter of this model. |
void |
addToStatistic(boolean forward,
int startPos,
int endPos,
double weight,
Sequence seq)
This method adds the weight to the internal sufficient statistic. |
protected void |
appendFurtherInformation(StringBuffer xml)
This method appends further information to the XML representation. |
PhyloDiscreteEmission |
clone()
|
void |
estimateFromStatistic()
This method estimates the parameters from the internal sufficient statistic. |
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 |
getLogPosteriorFromStatistic()
This method calculates the a-posteriori probability for the current statistics |
double |
getLogProbAndPartialDerivationFor(boolean forward,
int startPos,
int endPos,
IntList indices,
DoubleList partDer,
Sequence seq)
Returns the logarithmic score for a Sequence beginning at
position start in the Sequence and fills lists with
the indices and the partial derivations. |
double |
getLogProbFor(boolean forward,
int startPos,
int endPos,
Sequence seq)
This method computes the logarithm of the likelihood. |
double |
getLogProposalPosteriorFromStatistic()
Returns the log posterior of the proposal distribution for the current statistic |
void |
resetStatistic()
This method resets the internal sufficient statistic. |
Methods inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.hmm.states.emissions.discrete.DiscreteEmission |
---|
getConditionIndex, toString |
Methods inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.hmm.states.emissions.discrete.AbstractConditionalDiscreteEmission |
---|
acceptParameters, drawParametersFromStatistic, extendSampling, fillCurrentParameter, fillSamplingGroups, finalize, fromXML, getAlphabetContainer, getHyperParams, getLogPriorTerm, getNodeLabel, getNodeShape, getNumberOfParameters, getSizeOfEventSpace, initForSampling, initializeFunctionRandomly, isInSamplingMode, joinStatistics, parseNextParameterSet, parseParameterSet, precompute, samplingStopped, setLinear, setParameter, setParameterOffset, setParameters, setShape, toXML |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface de.jstacs.sampling.SamplingFromStatistic |
---|
drawParametersFromStatistic |
Methods inherited from interface de.jstacs.sampling.SamplingComponent |
---|
acceptParameters, extendSampling, initForSampling, isInSamplingMode, parseNextParameterSet, parseParameterSet, samplingStopped |
Methods inherited from interface de.jstacs.sequenceScores.statisticalModels.trainable.hmm.states.emissions.Emission |
---|
getAlphabetContainer, getLogPriorTerm, getNodeLabel, getNodeShape, initializeFunctionRandomly, joinStatistics, setParameters |
Methods inherited from interface de.jstacs.Storable |
---|
toXML |
Constructor Detail |
---|
public PhyloDiscreteEmission(AlphabetContainer con, double ess, PhyloTree t)
PhyloDiscreteEmission
based on the equivalent sample size.
con
- the AlphabetContainer
of this emissioness
- the equivalent sample size (ess) of this emission that is equally distributed over all parameterst
- the phylogenetic tree PhyloTree
public PhyloDiscreteEmission(AlphabetContainer con, double[] hyperParams, PhyloTree t)
DiscreteEmission
defining the individual hyper parameters.
con
- the AlphabetContainer
of this emissionhyperParams
- the individual hyper parameters for each parametert
- the phylogenetic tree PhyloTree
Method Detail |
---|
public PhyloDiscreteEmission clone() throws CloneNotSupportedException
clone
in class AbstractConditionalDiscreteEmission
CloneNotSupportedException
public double getLogProbFor(boolean forward, int startPos, int endPos, Sequence seq) throws OperationNotSupportedException
Emission
getLogProbFor
in interface Emission
getLogProbFor
in class AbstractConditionalDiscreteEmission
forward
- whether to use the forward or the reverse strandstartPos
- the start positionendPos
- the end positionseq
- the sequence
OperationNotSupportedException
- if forward=false
and the reverse complement of the sequence seq
is not definedpublic double getLogProbAndPartialDerivationFor(boolean forward, int startPos, int endPos, IntList indices, DoubleList partDer, Sequence seq) throws OperationNotSupportedException
DifferentiableEmission
Sequence
beginning at
position start
in the Sequence
and fills lists with
the indices and the partial derivations.
getLogProbAndPartialDerivationFor
in interface DifferentiableEmission
getLogProbAndPartialDerivationFor
in class AbstractConditionalDiscreteEmission
forward
- a switch whether to use the forward or the reverse complementary strand of the sequencestartPos
- the start position in the Sequence
endPos
- the end position in the Sequence
indices
- an IntList
of indices, after method invocation the
list should contain the indices i where
partDer
- a DoubleList
of partial derivations, after method
invocation the list should contain the corresponding
seq
- the Sequence
Sequence
OperationNotSupportedException
- if forward==false
and the reverse complement of the sequence can not be computedpublic void addGradientOfLogPriorTerm(double[] gradient, int offset)
DifferentiableEmission
Emission.getLogPriorTerm()
for each
parameter of this model. The results are added to the array
grad
beginning at index (offset
+ internal offset).
addGradientOfLogPriorTerm
in interface DifferentiableEmission
addGradientOfLogPriorTerm
in class AbstractConditionalDiscreteEmission
gradient
- the array of gradientsoffset
- the start index of the HMM in the grad
array, where the
partial derivations for the parameters of the HMM shall be
enteredEmission.getLogPriorTerm()
,
DifferentiableEmission.setParameterOffset(int)
public void estimateFromStatistic()
Emission
estimateFromStatistic
in interface Emission
estimateFromStatistic
in class AbstractConditionalDiscreteEmission
protected void appendFurtherInformation(StringBuffer xml)
AbstractConditionalDiscreteEmission
appendFurtherInformation
in class AbstractConditionalDiscreteEmission
xml
- the XML representationprotected void extractFurtherInformation(StringBuffer xml) throws NonParsableException
AbstractConditionalDiscreteEmission
extractFurtherInformation
in class AbstractConditionalDiscreteEmission
xml
- the XML representation
NonParsableException
- if the information could not be reconstructed out of the StringBuffer
xml
public double getLogProposalPosteriorFromStatistic()
public double getLogPosteriorFromStatistic()
SamplingFromStatistic
getLogPosteriorFromStatistic
in interface SamplingFromStatistic
getLogPosteriorFromStatistic
in class AbstractConditionalDiscreteEmission
public void resetStatistic()
Emission
resetStatistic
in interface Emission
resetStatistic
in class AbstractConditionalDiscreteEmission
public void addToStatistic(boolean forward, int startPos, int endPos, double weight, Sequence seq) throws OperationNotSupportedException
Emission
weight
to the internal sufficient statistic.
addToStatistic
in interface Emission
addToStatistic
in class AbstractConditionalDiscreteEmission
forward
- whether to use the forward or the reverse strandstartPos
- the start positionendPos
- the end positionweight
- the weight of the sequenceseq
- the sequence
OperationNotSupportedException
- if forward=false
and the reverse complement of the sequence seq
is not definedpublic double getLogGammaScoreFromStatistic()
SamplingEmission
getLogGammaScoreFromStatistic
in interface SamplingEmission
getLogGammaScoreFromStatistic
in class AbstractConditionalDiscreteEmission
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |