de.jstacs.scoringFunctions.mix
Class VariableLengthMixtureScoringFunction
java.lang.Object
de.jstacs.scoringFunctions.AbstractNormalizableScoringFunction
de.jstacs.scoringFunctions.mix.AbstractMixtureScoringFunction
de.jstacs.scoringFunctions.mix.MixtureScoringFunction
de.jstacs.scoringFunctions.mix.VariableLengthMixtureScoringFunction
- All Implemented Interfaces:
- MotifDiscoverer, MutableMotifDiscoverer, NormalizableScoringFunction, ScoringFunction, VariableLengthScoringFunction, Storable, Cloneable
public class VariableLengthMixtureScoringFunction
- extends MixtureScoringFunction
- implements VariableLengthScoringFunction
This class implements a mixture of VariableLengthScoringFunction
by extending MixtureScoringFunction
and implementing the methods of VariableLengthScoringFunction
.
- Author:
- Jens Keilwagen
Fields inherited from class de.jstacs.scoringFunctions.mix.AbstractMixtureScoringFunction |
componentScore, dList, freeParams, function, hiddenParameter, hiddenPotential, iList, logGammaSum, logHiddenNorm, logHiddenPotential, norm, optimizeHidden, paramRef, partNorm |
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 partialDer)
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 class de.jstacs.scoringFunctions.mix.MixtureScoringFunction |
adjustHiddenParameters, clone, fillComponentScores, getEss, getGlobalIndexOfMotifInComponent, getHyperparameterForHiddenParameter, getIndexOfMaximalComponentFor, getInstanceName, getLogNormalizationConstantForComponent, getLogPartialNormalizationConstant, getLogScoreAndPartialDerivation, getMotifLength, getNumberOfMotifs, getNumberOfMotifsInComponent, getProfileOfScoresFor, getStrandProbabilitiesFor, initializeMotif, initializeMotifRandomly, initializeUsingPlugIn, modifyMotif, toString |
Methods inherited from class de.jstacs.scoringFunctions.mix.AbstractMixtureScoringFunction |
addGradientOfLogPriorTerm, cloneFunctions, computeHiddenParameter, computeLogGammaSum, determineIsNormalized, extractFurtherInformation, fromXML, getCurrentParameterValues, getFunction, getFunctions, getFurtherInformation, getIndexOfMaximalComponentFor, getIndices, getLogNormalizationConstant, getLogPriorTerm, getLogScore, getNumberOfComponents, getNumberOfParameters, getNumberOfRecommendedStarts, getProbsForComponent, getScoringFunctions, getSizeOfEventSpaceForRandomVariablesOfParameter, getXMLTag, init, initializeFunction, initializeFunctionRandomly, initializeHiddenPotentialRandomly, initializeHiddenUniformly, initWithLength, isInitialized, isNormalized, precomputeNorm, setHiddenParameters, setParameters, setParametersForFunction, toXML |
Methods inherited from interface de.jstacs.scoringFunctions.ScoringFunction |
clone, getAlphabetContainer, getCurrentParameterValues, getInstanceName, getLength, getLogScore, getLogScore, getLogScoreAndPartialDerivation, getLogScoreAndPartialDerivation, getNumberOfParameters, getNumberOfRecommendedStarts, initializeFunction, initializeFunctionRandomly, isInitialized, setParameters |
VariableLengthMixtureScoringFunction
public VariableLengthMixtureScoringFunction(int starts,
boolean plugIn,
VariableLengthScoringFunction... component)
throws CloneNotSupportedException
- This constructor creates a new
VariableLengthMixtureScoringFunction
.
- Parameters:
starts
- the number of starts that should be done in an optimizationplugIn
- indicates whether the initial parameters for an optimization
should be related to the data or randomly drawncomponent
- the VariableLengthScoringFunction
s
- Throws:
CloneNotSupportedException
- if an element of component
could not be cloned
VariableLengthMixtureScoringFunction
public VariableLengthMixtureScoringFunction(StringBuffer xml)
throws NonParsableException
- This is the constructor for the interface
Storable
.
Creates a new VariableLengthMixtureScoringFunction
out of a
StringBuffer
.
- Parameters:
xml
- the XML representation as StringBuffer
- Throws:
NonParsableException
- if the XML representation could not be parsed
getLogScore
public double getLogScore(Sequence seq,
int start,
int length)
- Description copied from interface:
VariableLengthScoringFunction
- This method computes the logarithm of the score for a given subsequence.
- Specified by:
getLogScore
in interface VariableLengthScoringFunction
- 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,
int length,
IntList indices,
DoubleList partialDer)
- Description copied from interface:
VariableLengthScoringFunction
- This method computes the logarithm of the score and the partial
derivations for a given subsequence.
- Specified by:
getLogScoreAndPartialDerivation
in interface VariableLengthScoringFunction
- 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
is not zeropartialDer
- a DoubleList
of partial derivations, after method
invocation the list should contain the corresponding
that are not zero
- Returns:
- the logarithm of the score
- See Also:
ScoringFunction.getLogScoreAndPartialDerivation(Sequence, int,
IntList, DoubleList)
getLogNormalizationConstant
public double getLogNormalizationConstant(int length)
- Description copied from interface:
VariableLengthScoringFunction
- This method returns the logarithm of the normalization constant for a given sequence
length.
- Specified by:
getLogNormalizationConstant
in interface VariableLengthScoringFunction
- Parameters:
length
- the sequence length
- Returns:
- the logarithm of the normalization constant
- See Also:
NormalizableScoringFunction.getLogNormalizationConstant()
getLogPartialNormalizationConstant
public double getLogPartialNormalizationConstant(int parameterIndex,
int length)
throws Exception
- Description copied from interface:
VariableLengthScoringFunction
- This method returns the logarithm of the partial normalization constant for a given
parameter index and a sequence length.
- Specified by:
getLogPartialNormalizationConstant
in interface VariableLengthScoringFunction
- Parameters:
parameterIndex
- the index of the parameterlength
- the sequence length
- Returns:
- the logarithm of the partial normalization constant
- Throws:
Exception
- if something went wrong- See Also:
NormalizableScoringFunction.getLogPartialNormalizationConstant(int)
setStatisticForHyperparameters
public void setStatisticForHyperparameters(int[] length,
double[] weight)
throws Exception
- Description copied from interface:
VariableLengthScoringFunction
- 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.
- Specified by:
setStatisticForHyperparameters
in interface VariableLengthScoringFunction
- Parameters:
length
- the non-negative lengths of the sequencesweight
- the non-negative weight for the corresponding sequence
- Throws:
Exception
- if something went wrong- See Also:
Mutable