|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.models.discrete.Constraint
de.jstacs.models.discrete.inhomogeneous.InhConstraint
de.jstacs.models.discrete.inhomogeneous.InhCondProb
public class InhCondProb
This class handles the (conditional) probabilities.
Field Summary |
---|
Fields inherited from class de.jstacs.models.discrete.inhomogeneous.InhConstraint |
---|
offset |
Fields inherited from class de.jstacs.models.discrete.Constraint |
---|
counts, freq, usedPositions |
Constructor Summary | |
---|---|
InhCondProb(int[] pos,
int[] alphabetLength,
boolean cond)
|
|
InhCondProb(int pos,
int... alphabetLength)
|
|
InhCondProb(StringBuffer xml)
The constructor for saved objects. |
Method Summary | |
---|---|
protected void |
appendAdditionalInfo(StringBuffer xml)
This method appends additional information that are not stored in the base class to the StringBuffer. |
InhCondProb |
clone()
|
void |
drawParameters(double ess)
Draws the parameters using the counts and the given ESS 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. |
void |
estimateUnConditional(double ess,
double all)
Estimates the unconditional frequencies using the ess. |
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 are not parsed in the base class. |
double |
getLnFreq(int index)
Returns the logarithmic frequency. |
double |
getLnFreq(Sequence s,
int start)
Returns the logarithmic frequency. |
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.models.discrete.inhomogeneous.InhConstraint |
---|
satisfiesSpecificConstraint |
Methods inherited from class de.jstacs.models.discrete.Constraint |
---|
add, add, getCount, getFreq, getFreq, getMarginalOrder, getNumberOfSpecificConstraints, getPosition, getPositions, reset, 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)
pos
- the positionsalphabetLength
- the length of each alphabet (not only the used positions)public InhCondProb(int[] pos, int[] alphabetLength, boolean cond)
pos
- the positionsalphabetLength
- the length of each alphabet (not only the used positions)cond
- true if the probabilties
public InhCondProb(StringBuffer xml) throws NonParsableException
xml
- the representation
NonParsableException
- if the StringBuffer could not be parsed.Method Detail |
---|
public InhCondProb clone() throws CloneNotSupportedException
clone
in class InhConstraint
CloneNotSupportedException
public void drawParameters(double ess)
ess
- the given equivalent sample sizepublic void estimate(double ess)
Constraint
estimate
in class Constraint
ess
- the ESSpublic void estimateUnConditional(double ess, double all)
ess
- the ESSall
- the sum of all weights used to fill the countspublic double getLnFreq(int index)
index
- the index
public double getLnFreq(Sequence s, int start)
s
- the sequencestart
- the index of the start position
public void getOutput(byte[] content, double p) throws OperationNotSupportedException
content
- the content of the random sequence as far as it is knownp
- the random number in (0,1)
OperationNotSupportedException
Model.emitSample(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 pseudo count respectively the hyperparameterprotected void estimateUnConditional(int start, int end, double pc, boolean exceptionWhenNoData)
Constraint
estimateUnConditional
in class Constraint
start
- the start indexend
- the end indexpc
- the pseudocount for each parameterexceptionWhenNoData
- if true
an (runtime) exception is thrown if no data was available to estimate the
parametersprotected void appendAdditionalInfo(StringBuffer xml)
Constraint
appendAdditionalInfo
in class InhConstraint
xml
- the StringBuffer that is used for appending additional informationprotected String getXMLTag()
Constraint
getXMLTag
in class Constraint
protected void extractAdditionalInfo(StringBuffer xml) throws NonParsableException
Constraint
extractAdditionalInfo
in class InhConstraint
xml
- the StringBuffer to parse
NonParsableException
- if something with the parsing went wrongpublic void setFreqs(String[] array, int start) throws IllegalArgumentException
array
- the array of String chunks to be parsedstart
- the start index
IllegalArgumentException
- if something with the frequencies is not okay
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |