public class MEMConstraint extends InhConstraint
offset
counts, 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
![]() 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
![]() 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 ![]() val :
![]() |
void |
setLambda(int index,
double val)
Sets the value of
![]() (Additionally it sets the exponential value of ![]() val :
![]() |
String |
toString() |
getDescription, satisfiesSpecificConstraint
add, add, estimateUnConditional, getCount, getFreq, getFreqInfo, getMarginalOrder, getNumberOfSpecificConstraints, getPosition, getPositions, resetCounts, toXML
public 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.length
InhConstraint.InhConstraint(int[], int[])
public MEMConstraint(StringBuffer xml) throws NonParsableException
Storable
.
Creates a new MEMConstraint
out of its XML representation.xml
- the XML representation as StringBuffer
NonParsableException
- 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 InhConstraint
CloneNotSupportedException
public void estimate(double ess)
Constraint
estimate
in class Constraint
ess
- 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)
index
: index
- the indexpublic double getLambda(int index)
index
- the indexpublic void multiplyExpLambdaWith(int index, double val)
val
:
val
to the
value of index
:
index
- the indexval
- the factor/valuepublic void reset()
Constraint
reset
in class Constraint
public int satisfiesSpecificConstraint(SequenceIterator sequence)
sequence
.sequence
- the SequenceIterator
public double getFreq(int index)
Constraint
index
.getFreq
in class Constraint
index
- the indexpublic void setExpLambda(int index, double val)
val
:
index
- the indexval
- the value to be setpublic void setLambda(int index, double val)
val
:
index
- the indexval
- the valuepublic String toString()
toString
in class Constraint
protected void appendAdditionalInfo(StringBuffer xml)
Constraint
StringBuffer
.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
StringBuffer
that is not parsed in the base class.extractAdditionalInfo
in class InhConstraint
xml
- 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 constraint
slist
- 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 params
array