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.homogeneous
Class HomogeneousModel.HomCondProb

    java.lang.Object
      de.jstacs.models.discrete.Constraint
          de.jstacs.models.discrete.homogeneous.HomogeneousModel.HomCondProb

All Implemented Interfaces:
  Storable

Enclosing class:
  HomogeneousModel

    protected class HomogeneousModel.HomCondProb

extends Constraint

This class handles the (conditional) probabilities of a homogeneous model in a fast way.

Author:
  Jens Keilwagen

Field Summary

Fields inherited from class de.jstacs.models.discrete.Constraint
`counts, freq, usedPositions`

Constructor Summary
`HomogeneousModel.HomCondProb(HomogeneousModel.HomCondProb old)` Creates a new `HomogeneousModel.HomCondProb` instance from a given one.
`HomogeneousModel.HomCondProb(int[] pos, int n)` The main constructor.
`HomogeneousModel.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.
`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.models.discrete.Constraint
`add, add, clone, 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

### HomogeneousModel.HomCondProb

    public HomogeneousModel.HomCondProb(int[] pos,
                                        int n)

  The main constructor. Creates a new `HomogeneousModel.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)`.

  Parameters:
    `pos` - the used positions (will be cloned), have to be non-negative
    `n` - the number of specific constraints
  See Also:
    `Constraint.Constraint(int[], int)`

### HomogeneousModel.HomCondProb

    public HomogeneousModel.HomCondProb(StringBuffer xml)
                                 throws NonParsableException

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

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

### HomogeneousModel.HomCondProb

    public HomogeneousModel.HomCondProb(HomogeneousModel.HomCondProb old)

  Creates a new `HomogeneousModel.HomCondProb` instance from a given one. This constructor is used for cloning instances, since any instance is an inner instance of a `HomogeneousModel`.

  Parameters:
    `old` - the old instance to be cloned
  See Also:
    `HomogeneousModel.HomCondProb#HomCondProb(int[],int)`

Method Detail

### 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

### getLnFreq

    public double getLnFreq(int index)

  Returns the logarithmic frequency at a given position `index`.

  Parameters:
    `index` - the given index
  Returns:
    the logarithmic frequency at `index`

### satisfiesSpecificConstraint

    public int satisfiesSpecificConstraint(Sequence seq,
                                           int start)

  Description copied from class: `Constraint`
  This method returns the index of the specific constraint that is fulfilled by the `Sequence` `seq` beginning at position `start`.

  Specified by:
    `satisfiesSpecificConstraint` in class `Constraint`
  Parameters:
    `seq` - the sequence
    `start` - the start position
  Returns:
    the index of the fulfilled, specific constraint

### toString

    public String toString()

  Specified by:
    `toString` in class `Constraint`

### addAll

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

  Parameters:
    `seq` - the `Sequence`
    `weight` - the given weight
    `start` - the first index within the `Sequence`
    `prevIndex` - the previous index used for adding a count

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

  Specified by:
    `appendAdditionalInfo` in class `Constraint`
  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

### estimateUnConditional

    protected void estimateUnConditional(int start,
                                         int end,
                                         double pc,
                                         boolean exceptionWhenNoData)

  Description copied from class: `Constraint`
  Estimates unconditionally.

  Overrides:
    `estimateUnConditional` in class `Constraint`
  Parameters:
    `start` - the start index
    `end` - the end index
    `pc` - the pseudocount for each parameter
    `exceptionWhenNoData` - indicates if an (runtime) exception is thrown if no data was available to estimate the parameters

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

  Specified by:
    `extractAdditionalInfo` in class `Constraint`
  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