public class PhyloDiscreteEmission extends DiscreteEmission implements SamplingEmission
con, counter, ess, grad, hyperParams, logNorm, offset, params, paramsFile, probs, reader, samplingIndex, statistic, writer| Constructor and Description |
|---|
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. |
| Modifier and Type | Method and Description |
|---|---|
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)
|
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.
|
getConditionIndex, toStringacceptParameters, drawParameters, 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, toXMLequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdrawParametersFromStatisticacceptParameters, extendSampling, initForSampling, isInSamplingMode, parseNextParameterSet, parseParameterSet, samplingStoppedgetAlphabetContainer, getLogPriorTerm, getNodeLabel, getNodeShape, initializeFunctionRandomly, joinStatistics, setParameters, toStringpublic 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 PhyloTreepublic 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 PhyloTreepublic PhyloDiscreteEmission clone() throws CloneNotSupportedException
clone in class AbstractConditionalDiscreteEmissionCloneNotSupportedExceptionpublic double getLogProbFor(boolean forward,
int startPos,
int endPos,
Sequence seq)
throws OperationNotSupportedException
EmissiongetLogProbFor in interface EmissiongetLogProbFor in class AbstractConditionalDiscreteEmissionforward - whether to use the forward or the reverse strandstartPos - the start positionendPos - the end positionseq - the sequenceOperationNotSupportedException - 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
DifferentiableEmissionSequence beginning at
position start in the Sequence and fills lists with
the indices and the partial derivations.getLogProbAndPartialDerivationFor in interface DifferentiableEmissiongetLogProbAndPartialDerivationFor in class AbstractConditionalDiscreteEmissionforward - a switch whether to use the forward or the reverse complementary strand of the sequencestartPos - the start position in the SequenceendPos - the end position in the Sequenceindices - an IntList of indices, after method invocation the
list should contain the indices i where
is not zeropartDer - a DoubleList of partial derivations, after method
invocation the list should contain the corresponding
that are not zeroseq - the SequenceSequenceOperationNotSupportedException - if forward==false and the reverse complement of the sequence can not be computedpublic void addGradientOfLogPriorTerm(double[] gradient,
int offset)
DifferentiableEmissionEmission.getLogPriorTerm() for each
parameter of this model. The results are added to the array
grad beginning at index (offset + internal offset).addGradientOfLogPriorTerm in interface DifferentiableEmissionaddGradientOfLogPriorTerm in class AbstractConditionalDiscreteEmissiongradient - 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()
EmissionestimateFromStatistic in interface EmissionestimateFromStatistic in class AbstractConditionalDiscreteEmissionprotected void appendFurtherInformation(StringBuffer xml)
AbstractConditionalDiscreteEmissionappendFurtherInformation in class AbstractConditionalDiscreteEmissionxml - the XML representationprotected void extractFurtherInformation(StringBuffer xml) throws NonParsableException
AbstractConditionalDiscreteEmissionextractFurtherInformation in class AbstractConditionalDiscreteEmissionxml - the XML representationNonParsableException - if the information could not be reconstructed out of the StringBuffer xmlpublic double getLogProposalPosteriorFromStatistic()
public double getLogPosteriorFromStatistic()
SamplingFromStatisticgetLogPosteriorFromStatistic in interface SamplingFromStatisticgetLogPosteriorFromStatistic in class AbstractConditionalDiscreteEmissionpublic void resetStatistic()
EmissionresetStatistic in interface EmissionresetStatistic in class AbstractConditionalDiscreteEmissionpublic void addToStatistic(boolean forward,
int startPos,
int endPos,
double weight,
Sequence seq)
throws OperationNotSupportedException
Emissionweight to the internal sufficient statistic.addToStatistic in interface EmissionaddToStatistic in class AbstractConditionalDiscreteEmissionforward - whether to use the forward or the reverse strandstartPos - the start positionendPos - the end positionweight - the weight of the sequenceseq - the sequenceOperationNotSupportedException - if forward=false and the reverse complement of the sequence seq is not definedpublic double getLogGammaScoreFromStatistic()
SamplingEmissiongetLogGammaScoreFromStatistic in interface SamplingEmissiongetLogGammaScoreFromStatistic in class AbstractConditionalDiscreteEmission