de.jstacs.scoringFunctions
Interface VariableLengthScoringFunction

All Superinterfaces:
Cloneable, NormalizableScoringFunction, ScoringFunction, Storable
All Known Implementing Classes:
AbstractVariableLengthScoringFunction, CMMScoringFunction, HMM0ScoringFunction, HMMScoringFunction, HomogeneousScoringFunction, UniformHomogeneousScoringFunction, VariableLengthMixtureScoringFunction

public interface VariableLengthScoringFunction
extends NormalizableScoringFunction

This is an interface for all NormalizableScoringFunctions that allow to score subsequences of arbitrary length. This NormalizableScoringFunction should be the super class for non-motif NormalizableScoringFunctions like homogeneous Markov models, cyclic Markov models, ... etc.

Author:
Jens Keilwagen

Field Summary
 
Fields inherited from interface de.jstacs.scoringFunctions.ScoringFunction
UNKNOWN
 
Method Summary
 double getLogNormalizationConstant(int length)
          This method returns the logarithm of the normalization constant for a given sequence length.
 double getLogPartialNormalizationConstant(int parameterIndex, int length)
          This method returns the logarithm of the partial normalization constant for a given parameter index and a sequence length.
 double getLogScore(Sequence seq, int start, int length)
          This method computes the logarithm of the score for a given subsequence.
 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.
 void setStatisticForHyperparameters(int[] length, double[] weight)
          This method sets the hyperparameters for the model parameters by evaluating the given statistic.
 
Methods inherited from interface de.jstacs.scoringFunctions.NormalizableScoringFunction
addGradientOfLogPriorTerm, getEss, getInitialClassParam, getLogNormalizationConstant, getLogPartialNormalizationConstant, getLogPriorTerm, getSizeOfEventSpaceForRandomVariablesOfParameter, isNormalized
 
Methods inherited from interface de.jstacs.scoringFunctions.ScoringFunction
clone, getAlphabetContainer, getCurrentParameterValues, getInstanceName, getLength, getLogScore, getLogScore, getLogScoreAndPartialDerivation, getLogScoreAndPartialDerivation, getNumberOfParameters, getNumberOfRecommendedStarts, initializeFunction, initializeFunctionRandomly, isInitialized, setParameters
 
Methods inherited from interface de.jstacs.Storable
toXML
 

Method Detail

getLogNormalizationConstant

double getLogNormalizationConstant(int length)
This method returns the logarithm of the normalization constant for a given sequence length.

Parameters:
length - the sequence length
Returns:
the logarithm of the normalization constant
See Also:
NormalizableScoringFunction.getLogNormalizationConstant()

getLogPartialNormalizationConstant

double getLogPartialNormalizationConstant(int parameterIndex,
                                          int length)
                                          throws Exception
This method returns the logarithm of 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 logarithm of the partial normalization constant
Throws:
Exception - if something went wrong
See Also:
NormalizableScoringFunction.getLogPartialNormalizationConstant(int)

getLogScore

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

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)}{\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}$ that are not zero
Returns:
the logarithm of the score
See Also:
ScoringFunction.getLogScoreAndPartialDerivation(Sequence, int, IntList, DoubleList)

setStatisticForHyperparameters

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