de.jstacs.sequenceScores.statisticalModels.trainable.hmm.transitions
Interface DifferentiableTransition

All Superinterfaces:
Cloneable, Storable, Transition
All Known Subinterfaces:
TrainableAndDifferentiableTransition
All Known Implementing Classes:
HigherOrderTransition

public interface DifferentiableTransition
extends Transition

This class declares methods that allow for optimizing the parameters numerically using the Optimizer.

Author:
Jens Keilwagen

Method Summary
 void addGradientForLogPriorTerm(double[] gradient, int start)
          This method computes the gradient of Transition.getLogPriorTerm() for each parameter of this transition.
 void fillParameters(double[] params)
          This method allows to fill the parameters of the transition in a given array.
 void fillSamplingGroups(int parameterOffset, LinkedList<int[]> list)
          Adds the groups of indexes of those parameters of this transition that should be sampled together in one step of a grouped sampling procedure, each as an int[], into list.
 double getLogScoreAndPartialDerivation(int layer, int index, int childIdx, IntList indices, DoubleList partDer, Sequence sequence, int sequencePosition)
          This method allows to compute the logarithm of the score and the gradient for a specific transition.
 int getSizeOfEventSpace(int index)
          Returns the size of the event space, i.e., the number of possible outcomes, for the random variable of parameter index
 int setParameterOffset(int offset)
          This method sets the internal offset of the parameter index.
 void setParameters(double[] params, int start)
          This method allows to set the parameters of the transition.
 
Methods inherited from interface de.jstacs.sequenceScores.statisticalModels.trainable.hmm.transitions.Transition
clone, fillTransitionInformation, getChildIdx, getGraphizNetworkRepresentation, getLastContextState, getLogPriorTerm, getLogScoreFor, getMaximalInDegree, getMaximalMarkovOrder, getMaximalNumberOfChildren, getNumberOfChildren, getNumberOfIndexes, getNumberOfStates, hasAnySelfTransitions, initializeRandomly, isAbsoring, setParameters, toString
 
Methods inherited from interface de.jstacs.Storable
toXML
 

Method Detail

setParameterOffset

int setParameterOffset(int offset)
This method sets the internal offset of the parameter index.

Parameters:
offset - the offset
Returns:
the offset for the next parameters

setParameters

void setParameters(double[] params,
                   int start)
This method allows to set the parameters of the transition.

Parameters:
params - the parameters
start - the (global) start position

fillParameters

void fillParameters(double[] params)
This method allows to fill the parameters of the transition in a given array.

Parameters:
params - the parameters

getLogScoreAndPartialDerivation

double getLogScoreAndPartialDerivation(int layer,
                                       int index,
                                       int childIdx,
                                       IntList indices,
                                       DoubleList partDer,
                                       Sequence sequence,
                                       int sequencePosition)
This method allows to compute the logarithm of the score and the gradient for a specific transition.

Parameters:
layer - the layer of the matrix
index - the index encoding the context
childIdx - the index of the child
indices - a list for the parameter indices
partDer - a list for the partial derivations
sequencePosition - the position within the sequence
sequence - the sequence
Returns:
the logarithm of the score
See Also:
Transition.getLogScoreFor(int, int, int, Sequence, int)

addGradientForLogPriorTerm

void addGradientForLogPriorTerm(double[] gradient,
                                int start)
This method computes the gradient of Transition.getLogPriorTerm() for each parameter of this transition. The results are added to the array gradient beginning at index start.

Parameters:
gradient - the array of gradients
start - the start index in the gradient array, where the partial derivations for the parameters of this Transition shall be entered

getSizeOfEventSpace

int getSizeOfEventSpace(int index)
Returns the size of the event space, i.e., the number of possible outcomes, for the random variable of parameter index

Parameters:
index - the index of the parameter
Returns:
the size of the event space

fillSamplingGroups

void fillSamplingGroups(int parameterOffset,
                        LinkedList<int[]> list)
Adds the groups of indexes of those parameters of this transition that should be sampled together in one step of a grouped sampling procedure, each as an int[], into list. In most cases, one group should contain the parameters that are living on a common simplex, e.g. the parameters of one TransitionElement of this transition. The internal indexes of the parameters are incremeneted by an external parameterOffset

Parameters:
parameterOffset - the external parameter offset
list - the list of sampling groups