|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jstacs.sequenceScores.statisticalModels.trainable.discrete.Constraint
de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.InhConstraint
de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.InhCondProb
public class InhCondProb
This class handles (conditional) probabilities of sequences for inhomogeneous models.
| Field Summary |
|---|
| Fields inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.InhConstraint |
|---|
offset |
| Fields inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.discrete.Constraint |
|---|
counts, freq, usedPositions |
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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()
|
| Methods inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.InhConstraint |
|---|
satisfiesSpecificConstraint |
| Methods inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.discrete.Constraint |
|---|
add, add, getCount, getFreq, getFreq, getFreqInfo, getMarginalOrder, getNumberOfSpecificConstraints, getPosition, getPositions, reset, resetCounts, toXML |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public 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 StringBuffer
NonParsableException - if the InhCondProb instance could not be
reconstructed out of the XML representation (the
StringBuffer could not be parsed)Storable,
InhConstraint.InhConstraint(StringBuffer)| Method Detail |
|---|
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)
Constraint
estimate in class Constraintess - the ess
public 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 distribution
public double getLnFreq(Sequence s,
int start)
Sequence s
beginning at start.
s - the sequencestart - the index of the start position
InhConstraint.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 Constraint
protected void drawUnConditional(int start,
int end,
double pc)
start - the start indexend - the end indexpc - the pseudocount/hyperparameter
protected void estimateUnConditional(int start,
int end,
double pc,
boolean exceptionWhenNoData)
Constraint
estimateUnConditional 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()
Constraint
getXMLTag in class Constraint
protected void extractAdditionalInfo(StringBuffer xml)
throws NonParsableException
ConstraintStringBuffer
that is not parsed in the base class.
extractAdditionalInfo in class InhConstraintxml - the StringBuffer to be parsed
NonParsableException - if something with the parsing went wrong
public 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 index
IllegalArgumentException - if something is wrong with the frequencies
public String getDescription(AlphabetContainer con,
int i)
Constrainti.
getDescription in class InhConstraintcon - the AlphabetContaineri - the encoded symbol
i
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||