public class MEMConstraint extends InhConstraint
offsetcounts, freq, usedPositions| Constructor and Description |
|---|
MEMConstraint(int[] pos,
int[] alphabetLength)
Creates a
MEMConstraint as part of a (whole) model. |
MEMConstraint(int[] pos,
int[] alphabetLength,
int[] corrected_positions)
Creates a
MEMConstraint as part of a model. |
MEMConstraint(StringBuffer xml)
The standard constructor for the interface
Storable. |
| Modifier and Type | Method and Description |
|---|---|
void |
addParameters(int offset,
IntList list,
MEMConstraint[] constraint,
double[] params,
int[] start)
This method implements a heuristic to modify a constraint if a number of constraints should be delete.
|
protected void |
appendAdditionalInfo(StringBuffer xml)
This method appends additional information that is not stored in the base
class to the
StringBuffer. |
MEMConstraint |
clone() |
int |
comparePosition(int offset,
MEMConstraint constr)
This method computes the number of overlapping positions between the current and the given constraints.
|
void |
draw(double ess)
Draws the parameters from a Dirichlet.
|
void |
estimate(double ess)
Estimates the (smoothed) relative frequencies using the ess
(equivalent sample size).
|
protected void |
extractAdditionalInfo(StringBuffer xml)
This method parses additional information from the
StringBuffer
that is not parsed in the base class. |
int |
getCorrectedPosition(int index)
Returns the value of the corrected position
index. |
double |
getExpLambda(int index)
Returns the exponential value of
at position
index: . |
double |
getFreq(int index)
Returns the current frequency with index
index. |
double |
getLambda(int index)
Returns the value of
. |
protected String |
getXMLTag()
Returns the XML tag that is used for the class to en- or decode.
|
void |
multiplyExpLambdaWith(int index,
double val)
Multiplies the exponential value of
with the factor val:
. |
void |
reset()
This method resets all member variables that are in some way counters,
frequencies, ...
|
int |
satisfiesSpecificConstraint(SequenceIterator sequence)
Returns the index of the constraint that is satisfied by
sequence. |
void |
setExpLambda(int index,
double val)
Sets the exponential value of
.(Additionally it sets the value of to the logarithmic value of val:
.) |
void |
setLambda(int index,
double val)
Sets the value of
.(Additionally it sets the exponential value of
to the exponential value of val:
. |
String |
toString() |
getDescription, satisfiesSpecificConstraintadd, add, estimateUnConditional, getCount, getFreq, getFreqInfo, getMarginalOrder, getNumberOfSpecificConstraints, getPosition, getPositions, resetCounts, toXMLpublic MEMConstraint(int[] pos,
int[] alphabetLength)
throws IllegalArgumentException
MEMConstraint as part of a (whole) model.pos - the used positions (have to be sorted)alphabetLength - an array containing the length of the the alphabet for each
position (of the whole model)IllegalArgumentException - if pos is not sortedConstraint.Constraint(int[], int)public MEMConstraint(int[] pos,
int[] alphabetLength,
int[] corrected_positions)
throws IllegalArgumentException
MEMConstraint as part of a model.pos - the used positions (have to be sorted)alphabetLength - an array containing the length of the the alphabet for each
position (of the whole model)corrected_positions - an array containing the corrected positions if the maximum
entropy model is decomposed into partsIllegalArgumentException - if pos is not sorted or
pos.length != corrected_positions.lengthInhConstraint.InhConstraint(int[], int[])public MEMConstraint(StringBuffer xml) throws NonParsableException
Storable.
Creates a new MEMConstraint out of its XML representation.xml - the XML representation as StringBufferNonParsableException - if the MEMConstraint could not be reconstructed out
of the XML representation (the StringBuffer could not
be parsed)Storable,
InhConstraint.InhConstraint(StringBuffer)public MEMConstraint clone() throws CloneNotSupportedException
clone in class InhConstraintCloneNotSupportedExceptionpublic void estimate(double ess)
Constraintestimate in class Constraintess - the esspublic void draw(double ess)
ess - the equivalent sample sizepublic int getCorrectedPosition(int index)
index.index - the index of the positionpublic double getExpLambda(int index)
at position
index:
.index - the index
public double getLambda(int index)
.index - the index
public void multiplyExpLambdaWith(int index,
double val)
with the factor val:
. val to the
value of
at position index:
.)index - the indexval - the factor/valuepublic void reset()
Constraintreset in class Constraintpublic int satisfiesSpecificConstraint(SequenceIterator sequence)
sequence.sequence - the SequenceIteratorpublic double getFreq(int index)
Constraintindex.getFreq in class Constraintindex - the indexpublic void setExpLambda(int index,
double val)
.
to the logarithmic value of val:
.)index - the indexval - the value to be setpublic void setLambda(int index,
double val)
.
to the exponential value of val:
.index - the indexval - the valuepublic String toString()
toString in class Constraintprotected 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 int comparePosition(int offset,
MEMConstraint constr)
offset - the offset for the given constraintconstr - the given constraintpublic void addParameters(int offset,
IntList list,
MEMConstraint[] constraint,
double[] params,
int[] start)
offset - the offset for the constraintslist - a list of indices of constraints that should be used in this methodconstraint - the constraintsparams - the parametersstart - the start indices of the constraints in the paramsarray