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 ScoringFunctions that allow to score subsequences of arbitrary length. This ScoringFunction should be the super class for non-motif ScoringFunctions like homogeneous Markov models, cyclic Markov models, ...

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 that models sequence s of arbitrary length.
`protected` | `VariableLengthScoringFunction(AlphabetContainer alphabets, int length)` This is the main constructor that creates an instance that models sequence s of a given length.
`protected` | `VariableLengthScoringFunction(StringBuffer source)` This is the constructor for `Storable`.

Method Summary
`abstract double[][][]` | `getAllConditionalStationaryDistributions()` This method returns the all stationary conditional distribution.
`double` | `getLogScore(Sequence seq, int start)` Returns the log score for 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 log score for the sequence and fills the list 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 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 that models sequence s of arbitrary length.

  Parameters:
    `alphabets` - the AlphabetContainer

### VariableLengthScoringFunction

    protected VariableLengthScoringFunction(AlphabetContainer alphabets,
                                            int length)

  This is the main constructor that creates an instance that models sequence s of a given length.

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

### VariableLengthScoringFunction

    protected VariableLengthScoringFunction(StringBuffer source)
                                     throws NonParsableException

  This is the constructor for `Storable`.

  Parameters:
    `source` - the xml representation
  Throws:
    `NonParsableException` - if the 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` `\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

### getPartialNormalizationConstant

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

  This method returns the partial normalization constant for a given parameter index and 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 log score for the sequence

  Parameters:
    `seq` - the sequence
    `start` - the startposition in the sequence
  Returns:
    the log 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
    `length` - the end index
  Returns:
    the logarithm of the score
  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 log score for the sequence and fills the list with the indices and the partial derivations.

  Parameters:
    `seq` - the sequence
    `start` - the startposition in the sequence
    `indices` - after method invocation the list should contain the indices i where \frac{\partial \log score(seq)}{\partial \lambda_i} is not zero
    `dList` - after method invocation the list should contain the corresponding \frac{\partial \log score(seq)}{\partial \lambda_i}
  Returns:
    the log score

### 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
    `length` - the end index
    `indices` - the list for the indices of the parameters
    `dList` - the list for the partial derivations
  Returns:
    the logarithm of the score
  See Also:
    `ScoringFunction.getLogScoreAndPartialDerivation(Sequence, int, IntList, DoubleList)`

### getAllConditionalStationaryDistributions

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

  This method returns the all stationary conditional distribution. 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 value 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 `de.jstacs.motifDiscovery.Mutable#expand(int, double[], double[], double)`, `de.jstacs.motifDiscovery.Mutable#shift(double[], double[], double)`, and `de.jstacs.motifDiscovery.Mutable#shrink(double[], double[], double)` .

  Returns:
    the 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