de.jstacs.sequenceScores.differentiable
Interface DifferentiableSequenceScore

All Superinterfaces:
Cloneable, SequenceScore, Storable
All Known Subinterfaces:
DifferentiableStatisticalModel, SamplingDifferentiableStatisticalModel, VariableLengthDiffSM
All Known Implementing Classes:
AbstractDifferentiableSequenceScore, AbstractDifferentiableStatisticalModel, AbstractMixtureDiffSM, AbstractVariableLengthDiffSM, BayesianNetworkDiffSM, CyclicMarkovModelDiffSM, DifferentiableHigherOrderHMM, DurationDiffSM, ExtendedZOOPSDiffSM, HomogeneousDiffSM, HomogeneousMM0DiffSM, HomogeneousMMDiffSM, IndependentProductDiffSM, IndependentProductDiffSS, LogisticDiffSS, MappingDiffSM, MarkovModelDiffSM, MarkovRandomFieldDiffSM, MixtureDiffSM, MixtureDurationDiffSM, MultiDimensionalSequenceWrapperDiffSS, NormalizedDiffSM, PositionDiffSM, SkewNormalLikeDurationDiffSM, StrandDiffSM, UniformDiffSM, UniformDiffSS, UniformDurationDiffSM, UniformHomogeneousDiffSM, VariableLengthMixtureDiffSM

public interface DifferentiableSequenceScore
extends SequenceScore

This interface is the main part of any ScoreClassifier.

Author:
Jens Keilwagen, Jan Grau

Field Summary
static int UNKNOWN
          Indicates that the number of parameters of this DifferentiableSequenceScore is not known (yet).
 
Method Summary
 DifferentiableSequenceScore clone()
          Creates a clone (deep copy) of the current DifferentiableSequenceScore instance.
 double[] getCurrentParameterValues()
          Returns a double array of dimension getNumberOfParameters() containing the current parameter values.
 double getInitialClassParam(double classProb)
          Returns the initial class parameter for the class this DifferentiableSequenceScore is responsible for, based on the class probability classProb.
 double getLogScoreAndPartialDerivation(Sequence seq, int start, int end, IntList indices, DoubleList partialDer)
          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 getLogScoreAndPartialDerivation(Sequence seq, int start, IntList indices, DoubleList partialDer)
          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 getLogScoreAndPartialDerivation(Sequence seq, IntList indices, DoubleList partialDer)
          Returns the logarithmic score for a Sequence seq and fills lists with the indices and the partial derivations.
 int getNumberOfParameters()
          Returns the number of parameters in this DifferentiableSequenceScore.
 int getNumberOfRecommendedStarts()
          This method returns the number of recommended optimization starts.
 void initializeFunction(int index, boolean freeParams, DataSet[] data, double[][] weights)
          This method creates the underlying structure of the DifferentiableSequenceScore.
 void initializeFunctionRandomly(boolean freeParams)
          This method initializes the DifferentiableSequenceScore randomly.
 void setParameters(double[] params, int start)
          This method sets the internal parameters to the values of params between start and start + getNumberOfParameters() - 1
 
Methods inherited from interface de.jstacs.sequenceScores.SequenceScore
getAlphabetContainer, getCharacteristics, getInstanceName, getLength, getLogScoreFor, getLogScoreFor, getLogScoreFor, getLogScoreFor, getLogScoreFor, getNumericalCharacteristics, isInitialized, toString
 
Methods inherited from interface de.jstacs.Storable
toXML
 

Field Detail

UNKNOWN

static final int UNKNOWN
Indicates that the number of parameters of this DifferentiableSequenceScore is not known (yet).

See Also:
Constant Field Values
Method Detail

clone

DifferentiableSequenceScore clone()
                                  throws CloneNotSupportedException
Creates a clone (deep copy) of the current DifferentiableSequenceScore instance.

Specified by:
clone in interface SequenceScore
Returns:
the cloned instance of the current DifferentiableSequenceScore
Throws:
CloneNotSupportedException - if something went wrong while cloning the DifferentiableSequenceScore

initializeFunction

void initializeFunction(int index,
                        boolean freeParams,
                        DataSet[] data,
                        double[][] weights)
                        throws Exception
This method creates the underlying structure of the DifferentiableSequenceScore.

Parameters:
index - the index of the class the DifferentiableSequenceScore models
freeParams - indicates whether the (reduced) parameterization is used
data - the data sets
weights - the weights of the sequences in the data sets
Throws:
Exception - if something went wrong

initializeFunctionRandomly

void initializeFunctionRandomly(boolean freeParams)
                                throws Exception
This method initializes the DifferentiableSequenceScore randomly. It has to create the underlying structure of the DifferentiableSequenceScore.

Parameters:
freeParams - indicates whether the (reduced) parameterization is used
Throws:
Exception - if something went wrong

getLogScoreAndPartialDerivation

double getLogScoreAndPartialDerivation(Sequence seq,
                                       IntList indices,
                                       DoubleList partialDer)
Returns the logarithmic score for a Sequence seq and fills lists with the indices and the partial derivations.

Parameters:
seq - 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
partialDer - 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 logarithmic score for the Sequence

getLogScoreAndPartialDerivation

double getLogScoreAndPartialDerivation(Sequence seq,
                                       int start,
                                       IntList indices,
                                       DoubleList partialDer)
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
partialDer - 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 logarithmic score for the Sequence

getLogScoreAndPartialDerivation

double getLogScoreAndPartialDerivation(Sequence seq,
                                       int start,
                                       int end,
                                       IntList indices,
                                       DoubleList partialDer)
                                       throws Exception
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
end - the end position (inclusive) 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
partialDer - 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 logarithmic score for the Sequence
Throws:
Exception - if, for instance, the subsequence length can not be handled

getNumberOfParameters

int getNumberOfParameters()
Returns the number of parameters in this DifferentiableSequenceScore. If the number of parameters is not known yet, the method returns UNKNOWN.

Returns:
the number of parameters in this DifferentiableSequenceScore
See Also:
UNKNOWN

getNumberOfRecommendedStarts

int getNumberOfRecommendedStarts()
This method returns the number of recommended optimization starts. The standard implementation returns 1.

Returns:
the number of recommended optimization starts

getCurrentParameterValues

double[] getCurrentParameterValues()
                                   throws Exception
Returns a double array of dimension getNumberOfParameters() containing the current parameter values. If one likes to use these parameters to start an optimization it is highly recommended to invoke initializeFunction(int, boolean, DataSet[], double[][]) before. After an optimization this method can be used to get the current parameter values.

Returns:
the current parameter values
Throws:
Exception - if no parameters exist (yet)

setParameters

void setParameters(double[] params,
                   int start)
This method sets the internal parameters to the values of params between start and start + getNumberOfParameters() - 1

Parameters:
params - the new parameters
start - the start index in params

getInitialClassParam

double getInitialClassParam(double classProb)
Returns the initial class parameter for the class this DifferentiableSequenceScore is responsible for, based on the class probability classProb.

Parameters:
classProb - the class probability
Returns:
the initial class parameter