public class InhCondProb extends InhConstraint
offsetcounts, freq, usedPositions| Constructor and Description |
|---|
InhCondProb(int[] pos,
int[] alphabetLength,
boolean cond)
Creates a new
InhCondProb instance. |
InhCondProb(int pos,
int... alphabetLength)
Creates a new
InhCondProb instance. |
InhCondProb(StringBuffer xml)
The standard constructor for the interface
Storable. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
appendAdditionalInfo(StringBuffer xml)
This method appends additional information that is not stored in the base
class to the
StringBuffer. |
InhCondProb |
clone() |
void |
drawParameters(double ess)
Draws the parameters from a Dirichlet distribution using the counts and
the given
ess (equivalent sample size)
as hyperparameters. |
protected void |
drawUnConditional(int start,
int end,
double pc)
This method draws the parameters for a part of this constraint.
|
void |
estimate(double ess)
Estimates the (smoothed) relative frequencies using the ess
(equivalent sample size).
|
void |
estimateUnConditional(double ess,
double all)
Estimates the unconditional frequencies using the ess (equivalent
sample size).
|
protected void |
estimateUnConditional(int start,
int end,
double pc,
boolean exceptionWhenNoData)
Estimates unconditionally.
|
protected void |
extractAdditionalInfo(StringBuffer xml)
This method parses additional information from the
StringBuffer
that is not parsed in the base class. |
String |
getDescription(AlphabetContainer con,
int i)
Returns the decoded symbol for the encoded symbol
i. |
double |
getLnFreq(int index)
Returns the logarithm of the relative frequency (=probability) at
position
index in the distribution. |
double |
getLnFreq(Sequence s,
int start)
Returns the logarithm of the relative frequency (=probability) with the
position in the distribution given by the index of the specific
constraint that is fulfilled by the
Sequence s
beginning at start. |
void |
getOutput(byte[] content,
double p)
This method is used to create random sequences.
|
protected String |
getXMLTag()
Returns the XML tag that is used for the class to en- or decode.
|
void |
setFreqs(String[] array,
int start)
This method is used to restore the values of a Gibbs Sampling run.
|
String |
toString() |
satisfiesSpecificConstraintadd, add, getCount, getFreq, getFreq, getFreqInfo, getMarginalOrder, getNumberOfSpecificConstraints, getPosition, getPositions, reset, resetCounts, toXMLpublic InhCondProb(int pos,
int... alphabetLength)
InhCondProb instance.pos - the positionalphabetLength - the length of each alphabet (not only the used position)InhCondProb(int[], int[], boolean)public InhCondProb(int[] pos,
int[] alphabetLength,
boolean cond)
InhCondProb instance.pos - the positionsalphabetLength - the length of each alphabet (not only the used positions)cond - indicates if the instance has to use conditional probabilitiesInhConstraint.InhConstraint(int[], int[])public InhCondProb(StringBuffer xml) throws NonParsableException
Storable.
Creates a new InhCondProb instance out of its XML representation.xml - the XML representation as StringBufferNonParsableException - if the InhCondProb instance could not be
reconstructed out of the XML representation (the
StringBuffer could not be parsed)Storable,
InhConstraint.InhConstraint(StringBuffer)public InhCondProb clone() throws CloneNotSupportedException
clone in class InhConstraintCloneNotSupportedExceptionpublic void drawParameters(double ess)
ess (equivalent sample size)
as hyperparameters.ess - the given ess (equivalent sample size)drawUnConditional(int, int, double)public void estimate(double ess)
Constraintestimate in class Constraintess - the esspublic void estimateUnConditional(double ess,
double all)
ess - the ess (equivalent sample size)all - the sum of all weights used to fill the countspublic double getLnFreq(int index)
index in the distribution.index - the index of the entry in the distributionpublic double getLnFreq(Sequence s, int start)
Sequence s
beginning at start.s - the sequencestart - the index of the start positionInhConstraint.satisfiesSpecificConstraint(Sequence, int)public void getOutput(byte[] content,
double p)
throws OperationNotSupportedException
content - the content of the random sequence as far as it is knownp - a random number in (0,1)OperationNotSupportedException - if this instance models a joint probability for more than one
position (shall be implemented in the future)StatisticalModel.emitDataSet(int, int[])public String toString()
toString in class Constraintprotected void drawUnConditional(int start,
int end,
double pc)
start - the start indexend - the end indexpc - the pseudocount/hyperparameterprotected void estimateUnConditional(int start,
int end,
double pc,
boolean exceptionWhenNoData)
ConstraintestimateUnConditional in class Constraintstart - the start indexend - the end indexpc - the pseudocount for each parameterexceptionWhenNoData - indicates if an (runtime) exception is thrown if no data was
available to estimate the parametersprotected void appendAdditionalInfo(StringBuffer xml)
ConstraintStringBuffer.appendAdditionalInfo in class InhConstraintxml - the StringBuffer that is used for appending additional
informationprotected String getXMLTag()
ConstraintgetXMLTag in class Constraintprotected void extractAdditionalInfo(StringBuffer xml) throws NonParsableException
ConstraintStringBuffer
that is not parsed in the base class.extractAdditionalInfo in class InhConstraintxml - the StringBuffer to be parsedNonParsableException - if something with the parsing went wrongpublic void setFreqs(String[] array, int start) throws IllegalArgumentException
Strings. Each String is one
frequency. The index start is used to begin at a specific
position in the array.array - the array of String chunks to be parsedstart - the start indexIllegalArgumentException - if something is wrong with the frequenciespublic String getDescription(AlphabetContainer con, int i)
Constrainti.getDescription in class InhConstraintcon - the AlphabetContaineri - the encoded symboli