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.scoringFunctions
Class VariableLengthScoringFunction

    java.lang.Object
      de.jstacs.scoringFunctions.AbstractNormalizableScoringFunction
          de.jstacs.scoringFunctions.VariableLengthScoringFunction

All Implemented Interfaces:
  NormalizableScoringFunction, ScoringFunction, Storable, Cloneable

Direct Known Subclasses:
  HomogeneousScoringFunction

    public abstract class VariableLengthScoringFunction

extends AbstractNormalizableScoringFunction

This is the main class for all `ScoringFunction`s that allow to score subsequences of arbitrary length. This `ScoringFunction` should be the super class for non-motif `ScoringFunction`s like homogeneous Markov models, cyclic Markov models, ... etc.

Author:
  Jens Keilwagen

Field Summary

Fields inherited from class de.jstacs.scoringFunctions.AbstractNormalizableScoringFunction
`alphabets, length, r`

Fields inherited from interface de.jstacs.scoringFunctions.ScoringFunction
`UNKNOWN`

Constructor Summary
`protected` | `VariableLengthScoringFunction(AlphabetContainer alphabets)` This is the main constructor that creates an instance of a `VariableLengthScoringFunction` that models sequences of arbitrary length.
`protected` | `VariableLengthScoringFunction(AlphabetContainer alphabets, int length)` This is the main constructor that creates an instance of a `VariableLengthScoringFunction` that models sequences of a given length.
`protected` | `VariableLengthScoringFunction(StringBuffer source)` This is the constructor for the interface `Storable`.

Method Summary
`abstract double[][][]` | `getAllConditionalStationaryDistributions()` This method returns the stationary conditional distributions.
`double` | `getLogScore(Sequence seq, int start)` Returns the logarithmic score for the `Sequence` `seq` beginning at position `start` in the `Sequence`.
`abstract double` | `getLogScore(Sequence seq, int start, int length)` This method computes the logarithm of the score for a given subsequence.
`abstract double` | `getLogScoreAndPartialDerivation(Sequence seq, int start, int length, IntList indices, DoubleList dList)` This method computes the logarithm of the score and the partial derivations for a given subsequence.
`double` | `getLogScoreAndPartialDerivation(Sequence seq, int start, IntList indices, DoubleList dList)` Returns the logarithmic score for a `Sequence` beginning at position `start` in the `Sequence` and fills lists with the indices and the partial derivations.
`double` | `getNormalizationConstant()` Returns the sum of the scores over all sequences of the event space.
`abstract double` | `getNormalizationConstant(int length)` This method returns the normalization constant for a given sequence length.
`double` | `getPartialNormalizationConstant(int parameterIndex)` Returns the partial normalization constant for the parameter with index `parameterIndex`.
`abstract double` | `getPartialNormalizationConstant(int parameterIndex, int length)` This method returns the partial normalization constant for a given parameter index and a sequence length.
`abstract void` | `setStatisticForHyperparameters(int[] length, double[] weight)` This method sets the hyperparameters for the model parameters by evaluating the given statistic.

Methods inherited from class de.jstacs.scoringFunctions.AbstractNormalizableScoringFunction
`clone, fromXML, getAlphabetContainer, getInitialClassParam, getLength, getLogScore, getLogScoreAndPartialDerivation, getNumberOfRecommendedStarts, isNormalized, isNormalized`

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

Methods inherited from interface de.jstacs.scoringFunctions.NormalizableScoringFunction
`addGradientOfLogPriorTerm, getEss, getLogPriorTerm, getSizeOfEventSpaceForRandomVariablesOfParameter`

Methods inherited from interface de.jstacs.scoringFunctions.ScoringFunction
`getCurrentParameterValues, getInstanceName, getNumberOfParameters, initializeFunction, initializeFunctionRandomly, isInitialized, setParameters`

Methods inherited from interface de.jstacs.Storable
`toXML`

Constructor Detail

### VariableLengthScoringFunction

    protected VariableLengthScoringFunction(AlphabetContainer alphabets)

  This is the main constructor that creates an instance of a `VariableLengthScoringFunction` that models sequences of arbitrary length.

  Parameters:
    `alphabets` - the `AlphabetContainer` of this `VariableLengthScoringFunction`
  See Also:
    `VariableLengthScoringFunction(AlphabetContainer, int)`

### VariableLengthScoringFunction

    protected VariableLengthScoringFunction(AlphabetContainer alphabets,
                                            int length)

  This is the main constructor that creates an instance of a `VariableLengthScoringFunction` that models sequences of a given length.

  Parameters:
    `alphabets` - the `AlphabetContainer` of this `VariableLengthScoringFunction`
    `length` - the length of the modeled sequences

### VariableLengthScoringFunction

    protected VariableLengthScoringFunction(StringBuffer source)
                                     throws NonParsableException

  This is the constructor for the interface `Storable`. Creates a new `VariableLengthScoringFunction` out of its XML representation.

  Parameters:
    `source` - the XML representation as `StringBuffer`
  Throws:
    `NonParsableException` - if the XML representation could not be parsed.

Method Detail

### getNormalizationConstant

    public double getNormalizationConstant()

  Description copied from interface: `NormalizableScoringFunction`
  Returns the sum of the scores over all sequences of the event space.

  Returns:
    the normalization constant Z

### getNormalizationConstant

    public abstract double getNormalizationConstant(int length)

  This method returns the normalization constant for a given sequence length.

  Parameters:
    `length` - the sequence length
  Returns:
    the normalization constant
  See Also:
    `NormalizableScoringFunction.getNormalizationConstant()`

### getPartialNormalizationConstant

    public double getPartialNormalizationConstant(int parameterIndex)
                                           throws Exception

  Description copied from interface: `NormalizableScoringFunction`
  Returns the partial normalization constant for the parameter with index `parameterIndex`. This is the partial derivation of the normalization constant for the parameter with index `parameterIndex`, in LaTex notation: `\frac{\partial Z(\lambda)}{\partial \lambda_{index}}`.

  Parameters:
    `parameterIndex` - the index of the parameter
  Returns:
    the partial normalization constant
  Throws:
    `Exception` - if something went wrong with the normalization
  See Also:
    `NormalizableScoringFunction.getNormalizationConstant()`

### getPartialNormalizationConstant

    public abstract double getPartialNormalizationConstant(int parameterIndex,
                                                           int length)
                                                    throws Exception

  This method returns the partial normalization constant for a given parameter index and a sequence length.

  Parameters:
    `parameterIndex` - the index of the parameter
    `length` - the sequence length
  Returns:
    the partial normalization constant
  Throws:
    `Exception` - if something went wrong
  See Also:
    `NormalizableScoringFunction.getPartialNormalizationConstant(int)`

### getLogScore

    public double getLogScore(Sequence seq,
                              int start)

  Description copied from interface: `ScoringFunction`
  Returns the logarithmic score for the `Sequence` `seq` beginning at position `start` in the `Sequence`.

  Parameters:
    `seq` - the `Sequence`
    `start` - the start position in the `Sequence`
  Returns:
    the logarithmic score for the `Sequence`

### getLogScore

    public abstract double getLogScore(Sequence seq,
                                       int start,
                                       int length)

  This method computes the logarithm of the score for a given subsequence.

  Parameters:
    `seq` - the `Sequence`
    `start` - the start index in the `Sequence`
    `length` - the length of the `Sequence` beginning at `start`
  Returns:
    the logarithm of the score for the subsequence
  See Also:
    `ScoringFunction.getLogScore(Sequence, int)`

### getLogScoreAndPartialDerivation

    public double getLogScoreAndPartialDerivation(Sequence seq,
                                                  int start,
                                                  IntList indices,
                                                  DoubleList dList)

  Description copied from interface: `ScoringFunction`
  Returns the logarithmic score for a `Sequence` beginning at position `start` in the `Sequence` and fills lists with the indices and the partial derivations.

  Parameters:
    `seq` - the `Sequence`
    `start` - the start position in the `Sequence`
    `indices` - an `IntList` of indices, after method invocation the list should contain the indices i where `\frac{\partial \log score(seq)}{\partial \lambda_i}` is not zero
    `dList` - a `DoubleList` of partial derivations, after method invocation the list should contain the corresponding `\frac{\partial \log score(seq)}{\partial \lambda_i}`
  Returns:
    the logarithmic score for the `Sequence`

### getLogScoreAndPartialDerivation

    public abstract double getLogScoreAndPartialDerivation(Sequence seq,
                                                           int start,
                                                           int length,
                                                           IntList indices,
                                                           DoubleList dList)

  This method computes the logarithm of the score and the partial derivations for a given subsequence.

  Parameters:
    `seq` - the `Sequence`
    `start` - the start index in the `Sequence`
    `length` - the end index in the `Sequence`
    `indices` - an `IntList` of indices, after method invocation the list should contain the indices i where `\frac{\partial \log score(seq,start,length)}{\partial \lambda_i}` is not zero
    `dList` - a `DoubleList` of partial derivations, after method invocation the list should contain the corresponding `\frac{\partial \log score(seq,start,length)}{\partial \lambda_i}`
  Returns:
    the logarithm of the score
  See Also:
    `ScoringFunction.getLogScoreAndPartialDerivation(Sequence, int, IntList, DoubleList)`

### getAllConditionalStationaryDistributions

    public abstract double[][][] getAllConditionalStationaryDistributions()

  This method returns the stationary conditional distributions. The first dimension of the result is used for the order, the second is used for encoding the context, and the third is used for the different values of the random variable.
  For an homogeneous Markov model of order 2 it returns an array containing the stationary symbol distribution as first entry, the conditional stationary distribution of order 1 as second entry and the conditional distribution of order 2 as third entry.
  This method is used to determine the contrast for `Mutable.determineNotSignificantPositions(double, double[], double[], double[][][][], double[][][][], double)` .

  Returns:
    all conditional stationary distributions
  See Also:
    `Mutable`

### setStatisticForHyperparameters

    public abstract void setStatisticForHyperparameters(int[] length,
                                                        double[] weight)
                                                 throws Exception

  This method sets the hyperparameters for the model parameters by evaluating the given statistic. The statistic can be interpreted as follows: The model has seen a number of sequences. From these sequences it is only known how long (`length`) and how often ( `weight`) they have been seen.

  Parameters:
    `length` - the non-negative lengths of the sequences
    `weight` - the non-negative weight for the corresponding sequence
  Throws:
    `Exception` - if something went wrong
  See Also:
    `Mutable`

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