Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.jstacs.models.discrete.inhomogeneous
Class MEMConstraint

    java.lang.Object
      de.jstacs.models.discrete.Constraint
          de.jstacs.models.discrete.inhomogeneous.InhConstraint
              de.jstacs.models.discrete.inhomogeneous.MEMConstraint

All Implemented Interfaces:
  Storable, Cloneable

    public class MEMConstraint

extends InhConstraint

This constraint can be used for any maximum entropy model (MEM) application.

Author:
  Jens Keilwagen

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
`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`.

Method Summary
`protected void` | `appendAdditionalInfo(StringBuffer xml)` This method appends additional information that is not stored in the base class to the `StringBuffer`.
`MEMConstraint` | `clone()`
`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 .
`void` | `setLambda(int index, double val)` Sets the value of .
`String` | `toString()`

Methods inherited from class de.jstacs.models.discrete.inhomogeneous.InhConstraint
`getDescription, satisfiesSpecificConstraint`

Methods inherited from class de.jstacs.models.discrete.Constraint
`add, add, estimateUnConditional, getCount, getFreq, getFreqInfo, getMarginalOrder, getNumberOfSpecificConstraints, getPosition, getPositions, resetCounts, toXML`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### MEMConstraint

    public MEMConstraint(int[] pos,
                         int[] alphabetLength)
                  throws IllegalArgumentException

  Creates a `MEMConstraint` as part of a (whole) model.

  Parameters:
    `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)
  Throws:
    `IllegalArgumentException` - if `pos` is not sorted
  See Also:
    `Constraint.Constraint(int[], int)`

### MEMConstraint

    public MEMConstraint(int[] pos,
                         int[] alphabetLength,
                         int[] corrected_positions)
                  throws IllegalArgumentException

  Creates a `MEMConstraint` as part of a model.

  Parameters:
    `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 parts
  Throws:
    `IllegalArgumentException` - if `pos` is not sorted or `pos.length != corrected_positions.length`
  See Also:
    `InhConstraint.InhConstraint(int[], int[])`

### MEMConstraint

    public MEMConstraint(StringBuffer xml)
                  throws NonParsableException

  The standard constructor for the interface `Storable`. Creates a new `MEMConstraint` out of its XML representation.

  Parameters:
    `xml` - the XML representation as `StringBuffer`
  Throws:
    `NonParsableException` - if the `MEMConstraint` could not be reconstructed out of the XML representation (the `StringBuffer` could not be parsed)
  See Also:
    `Storable`, `InhConstraint.InhConstraint(StringBuffer)`

Method Detail

### clone

    public MEMConstraint clone()
                        throws CloneNotSupportedException

  Overrides:
    `clone` in class `InhConstraint`
  Throws:
    `CloneNotSupportedException`

### estimate

    public void estimate(double ess)

  Description copied from class: `Constraint`
  Estimates the (smoothed) relative frequencies using the ess (equivalent sample size).

  Specified by:
    `estimate` in class `Constraint`
  Parameters:
    `ess` - the ess

### draw

    public void draw(double ess)

  Draws the parameters from a Dirichlet.

  Parameters:
    `ess` - the equivalent sample size

### getCorrectedPosition

    public int getCorrectedPosition(int index)

  Returns the value of the corrected position `index`.

  Parameters:
    `index` - the index of the position
  Returns:
    the value of the corrected position

### getExpLambda

    public double getExpLambda(int index)

  Returns the exponential value of at position `index`: .

  Parameters:
    `index` - the index
  Returns:

### getLambda

    public double getLambda(int index)

  Returns the value of .

  Parameters:
    `index` - the index
  Returns:

### multiplyExpLambdaWith

    public void multiplyExpLambdaWith(int index,
                                      double val)

  Multiplies the exponential value of with the factor `val`: .
  (Additionally it adds the logarithmic value of `val` to the value of at position `index`: .)

  Parameters:
    `index` - the index
    `val` - the factor/value

### reset

    public void reset()

  Description copied from class: `Constraint`
  This method resets all member variables that are in some way counters, frequencies, ...

  Overrides:
    `reset` in class `Constraint`

### satisfiesSpecificConstraint

    public int satisfiesSpecificConstraint(SequenceIterator sequence)

  Returns the index of the constraint that is satisfied by `sequence`.

  Parameters:
    `sequence` - the `SequenceIterator`
  Returns:
    the index of the fulfilled constraint

### getFreq

    public double getFreq(int index)

  Description copied from class: `Constraint`
  Returns the current frequency with index `index`.

  Overrides:
    `getFreq` in class `Constraint`
  Parameters:
    `index` - the index
  Returns:
    the current frequency

### setExpLambda

    public void setExpLambda(int index,
                             double val)

  Sets the exponential value of .
  (Additionally it sets the value of to the logarithmic value of `val`: .)

  Parameters:
    `index` - the index
    `val` - the value to be set

### setLambda

    public void setLambda(int index,
                          double val)

  Sets the value of .
  (Additionally it sets the exponential value of to the exponential value of `val`: .

  Parameters:
    `index` - the index
    `val` - the value

### toString

    public String toString()

  Specified by:
    `toString` in class `Constraint`

### appendAdditionalInfo

    protected void appendAdditionalInfo(StringBuffer xml)

  Description copied from class: `Constraint`
  This method appends additional information that is not stored in the base class to the `StringBuffer`.

  Overrides:
    `appendAdditionalInfo` in class `InhConstraint`
  Parameters:
    `xml` - the `StringBuffer` that is used for appending additional information

### getXMLTag

    protected String getXMLTag()

  Description copied from class: `Constraint`
  Returns the XML tag that is used for the class to en- or decode.

  Specified by:
    `getXMLTag` in class `Constraint`
  Returns:
    the XML tag that is used for the class to en- or decode

### extractAdditionalInfo

    protected void extractAdditionalInfo(StringBuffer xml)
                                  throws NonParsableException

  Description copied from class: `Constraint`
  This method parses additional information from the `StringBuffer` that is not parsed in the base class.

  Overrides:
    `extractAdditionalInfo` in class `InhConstraint`
  Parameters:
    `xml` - the `StringBuffer` to be parsed
  Throws:
    `NonParsableException` - if something with the parsing went wrong

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD