|
||||||||||
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.discrete.Constraint
de.jstacs.sequenceScores.statisticalModels.trainable.discrete.homogeneous.HomogeneousTrainSM.HomCondProb
protected class HomogeneousTrainSM.HomCondProb
This class handles the (conditional) probabilities of a homogeneous model in a fast way.
Field Summary |
---|
Fields inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.discrete.Constraint |
---|
counts, freq, usedPositions |
Constructor Summary | |
---|---|
HomogeneousTrainSM.HomCondProb(HomogeneousTrainSM.HomCondProb old)
Creates a new HomogeneousTrainSM.HomCondProb instance from a given one. |
|
HomogeneousTrainSM.HomCondProb(int[] pos,
int n)
The main constructor. |
|
HomogeneousTrainSM.HomCondProb(StringBuffer xml)
The standard constructor for the interface Storable
. |
Method Summary | |
---|---|
void |
addAll(Sequence seq,
double weight,
int start,
int prevIndex)
Adds the given weight to the counts corresponding to the
Sequence seq from start to the end
of the Sequence . |
protected void |
appendAdditionalInfo(StringBuffer xml)
This method appends additional information that is not stored in the base class to the StringBuffer . |
void |
estimate(double ess)
Estimates the (smoothed) relative 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 logarithmic frequency at a given position index . |
protected String |
getXMLTag()
Returns the XML tag that is used for the class to en- or decode. |
int |
satisfiesSpecificConstraint(Sequence seq,
int start)
This method returns the index of the specific constraint that is fulfilled by the Sequence seq beginning at position
start . |
String |
toString()
|
Methods inherited from class de.jstacs.sequenceScores.statisticalModels.trainable.discrete.Constraint |
---|
add, add, clone, 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 HomogeneousTrainSM.HomCondProb(int[] pos, int n)
HomogeneousTrainSM.HomCondProb
instance and
checks that each position is used maximally once. In all/most cases
pos
is new int[]{0,1,2...}
and n
is Math.pow(Alphabet.length()
,pos.length)
.
pos
- the used positions (will be cloned), have to be
non-negativen
- the number of specific constraintsConstraint.Constraint(int[], int)
public HomogeneousTrainSM.HomCondProb(StringBuffer xml) throws NonParsableException
Storable
. Creates a new HomogeneousTrainSM.HomCondProb
instance out of its XML
representation.
xml
- the XML representation as StringBuffer
NonParsableException
- if the StringBuffer
could not be parsedStorable
,
Constraint.Constraint(StringBuffer)
public HomogeneousTrainSM.HomCondProb(HomogeneousTrainSM.HomCondProb old)
HomogeneousTrainSM.HomCondProb
instance from a given one. This
constructor is used for cloning instances, since any instance is an
inner instance of a HomogeneousTrainSM
.
old
- the old instance to be clonedHomogeneousTrainSM.HomCondProb#HomCondProb(int[],int)
Method Detail |
---|
public void estimate(double ess)
Constraint
estimate
in class Constraint
ess
- the esspublic double getLnFreq(int index)
index
.
index
- the given index
index
public int satisfiesSpecificConstraint(Sequence seq, int start)
Constraint
Sequence
seq
beginning at position
start
.
satisfiesSpecificConstraint
in class Constraint
seq
- the sequencestart
- the start position
public String toString()
toString
in class Constraint
public final void addAll(Sequence seq, double weight, int start, int prevIndex)
weight
to the counts corresponding to the
Sequence
seq
from start
to the end
of the Sequence
.
seq
- the Sequence
weight
- the given weightstart
- the first index within the Sequence
prevIndex
- the previous index used for adding a countprotected void appendAdditionalInfo(StringBuffer xml)
Constraint
StringBuffer
.
appendAdditionalInfo
in class Constraint
xml
- the StringBuffer
that is used for appending additional
informationprotected String getXMLTag()
Constraint
getXMLTag
in class Constraint
protected 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
- indicates if an (runtime) exception is thrown if no data was
available to estimate the parametersprotected void extractAdditionalInfo(StringBuffer xml) throws NonParsableException
Constraint
StringBuffer
that is not parsed in the base class.
extractAdditionalInfo
in class Constraint
xml
- the StringBuffer
to be parsed
NonParsableException
- if something with the parsing went wrongpublic String getDescription(AlphabetContainer con, int i)
Constraint
i
.
getDescription
in class Constraint
con
- the AlphabetContainer
i
- the encoded symbol
i
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |