|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jstacs.sequenceScores.differentiable.AbstractDifferentiableSequenceScore
de.jstacs.sequenceScores.statisticalModels.differentiable.AbstractDifferentiableStatisticalModel
de.jstacs.sequenceScores.statisticalModels.differentiable.mixture.motif.PositionDiffSM
de.jstacs.sequenceScores.statisticalModels.differentiable.mixture.motif.DurationDiffSM
de.jstacs.sequenceScores.statisticalModels.differentiable.mixture.motif.MixtureDurationDiffSM
public class MixtureDurationDiffSM
This class implements a mixture of DurationDiffSMs.
| Field Summary |
|---|
| Fields inherited from class de.jstacs.sequenceScores.statisticalModels.differentiable.mixture.motif.DurationDiffSM |
|---|
delta, ess, max, min |
| Fields inherited from class de.jstacs.sequenceScores.statisticalModels.differentiable.mixture.motif.PositionDiffSM |
|---|
internal |
| Fields inherited from class de.jstacs.sequenceScores.differentiable.AbstractDifferentiableSequenceScore |
|---|
alphabets, length, r |
| Fields inherited from interface de.jstacs.sequenceScores.differentiable.DifferentiableSequenceScore |
|---|
UNKNOWN |
| Constructor Summary | |
|---|---|
MixtureDurationDiffSM(int starts,
DurationDiffSM... function)
The main constructor of a MixtureDurationDiffSM. |
|
MixtureDurationDiffSM(StringBuffer source)
This is the constructor for Storable. |
|
| Method Summary | |
|---|---|
void |
addGradientOfLogPriorTerm(double[] grad,
int start)
This method computes the gradient of DifferentiableStatisticalModel.getLogPriorTerm() for each
parameter of this model. |
void |
adjust(int[] length,
double[] weight)
This method adjust the parameter based on the given statistic. |
MixtureDurationDiffSM |
clone()
Creates a clone (deep copy) of the current DifferentiableSequenceScore
instance. |
protected void |
fromXML(StringBuffer rep)
This method is called in the constructor for the Storable
interface to create a scoring function from a StringBuffer. |
double[] |
getCurrentParameterValues()
Returns a double array of dimension
DifferentiableSequenceScore.getNumberOfParameters() containing the current parameter values. |
String |
getInstanceName()
Should return a short instance name such as iMM(0), BN(2), ... |
double |
getLogPriorTerm()
This method computes a value that is proportional to |
double |
getLogScore(int... values)
This method enables the user to get the log-score without using a sequence object. |
double |
getLogScoreAndPartialDerivation(IntList indices,
DoubleList partialDer,
int... values)
This method enables the user to get the log-score and the partial derivations without using a sequence object. |
int |
getNumberOfParameters()
Returns the number of parameters in this DifferentiableSequenceScore. |
int |
getNumberOfRecommendedStarts()
This method returns the number of recommended optimization starts. |
protected String |
getRNotation(String distributionName,
NumberFormat nf)
This method returns the distribution in R notation. |
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 |
initializeUniformly()
This method set special parameters that lead to an uniform distribution. |
boolean |
isInitialized()
This method can be used to determine whether the instance is initialized. |
boolean |
isNormalized()
This method indicates whether the implemented score is already normalized to 1 or not. |
void |
modify(int delta)
This method modifies the underlying AlphabetContainer. |
void |
setParameters(double[] params,
int start)
This method sets the internal parameters to the values of params between start and
start + |
StringBuffer |
toXML()
This method returns an XML representation as StringBuffer of an
instance of the implementing class. |
| Methods inherited from class de.jstacs.sequenceScores.statisticalModels.differentiable.mixture.motif.DurationDiffSM |
|---|
getESS, getLogNormalizationConstant, getLogPartialNormalizationConstant, getMax, getMin, getNumberOfPossibilities, getSizeOfEventSpaceForRandomVariablesOfParameter, isPossible, next, reset, toString |
| Methods inherited from class de.jstacs.sequenceScores.statisticalModels.differentiable.mixture.motif.PositionDiffSM |
|---|
getInternalPosition, getLogScoreAndPartialDerivation, getLogScoreAndPartialDerivationForInternal, getLogScoreFor, getLogScoreForInternal, getValuesFromSequence |
| Methods inherited from class de.jstacs.sequenceScores.statisticalModels.differentiable.AbstractDifferentiableStatisticalModel |
|---|
emitDataSet, getInitialClassParam, getLogProbFor, getLogProbFor, getLogProbFor, getLogScoreFor, getLogScoreFor, getMaximalMarkovOrder, isNormalized |
| Methods inherited from class de.jstacs.sequenceScores.differentiable.AbstractDifferentiableSequenceScore |
|---|
getAlphabetContainer, getCharacteristics, getLength, getLogScoreAndPartialDerivation, getLogScoreAndPartialDerivation, getLogScoreFor, getLogScoreFor, getNumberOfStarts, getNumericalCharacteristics |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface de.jstacs.sequenceScores.differentiable.DifferentiableSequenceScore |
|---|
getLogScoreAndPartialDerivation, getLogScoreAndPartialDerivation |
| Methods inherited from interface de.jstacs.sequenceScores.SequenceScore |
|---|
getAlphabetContainer, getCharacteristics, getLength, getLogScoreFor, getLogScoreFor, getNumericalCharacteristics |
| Constructor Detail |
|---|
public MixtureDurationDiffSM(int starts,
DurationDiffSM... function)
throws WrongAlphabetException,
CloneNotSupportedException,
IllegalArgumentException
MixtureDurationDiffSM.
starts - the number of recommended startsfunction - the DurationDiffSMs for the components
CloneNotSupportedException - if at least one element of functions could not
be cloned
IllegalArgumentException - if the starts is smaller than zero (0)
WrongAlphabetException - if at least one element of function has
an AlphabetContainer that is not equal to those
of the other elements of function
public MixtureDurationDiffSM(StringBuffer source)
throws NonParsableException
Storable. Creates a new
MixtureDurationDiffSM out of a StringBuffer.
source - the XML representation as StringBuffer
NonParsableException - if the XML representation could not be parsed| Method Detail |
|---|
public MixtureDurationDiffSM clone()
throws CloneNotSupportedException
DifferentiableSequenceScoreDifferentiableSequenceScore
instance.
clone in interface DifferentiableSequenceScoreclone in interface SequenceScoreclone in class PositionDiffSMDifferentiableSequenceScore
CloneNotSupportedException - if something went wrong while cloning the
DifferentiableSequenceScore
public void adjust(int[] length,
double[] weight)
DurationDiffSM
adjust in class DurationDiffSMlength - an array containing length valuesweight - an array containing corresponding weight valuespublic double getLogScore(int... values)
PositionDiffSM
getLogScore in class PositionDiffSMvalues - the values
public double getLogScoreAndPartialDerivation(IntList indices,
DoubleList partialDer,
int... values)
PositionDiffSM
getLogScoreAndPartialDerivation in class PositionDiffSMindices - a list for the indices of the parameterspartialDer - a list of the partial derivationsvalues - the values
public void addGradientOfLogPriorTerm(double[] grad,
int start)
throws Exception
DifferentiableStatisticalModelDifferentiableStatisticalModel.getLogPriorTerm() for each
parameter of this model. The results are added to the array
grad beginning at index start.
grad - the array of gradientsstart - the start index in the grad array, where the
partial derivations for the parameters of this models shall be
entered
Exception - if something went wrong with the computing of the gradientsDifferentiableStatisticalModel.getLogPriorTerm()public double getLogPriorTerm()
DifferentiableStatisticalModel
DifferentiableStatisticalModel.getESS() * DifferentiableStatisticalModel.getLogNormalizationConstant() + Math.log( prior )
prior is the prior for the parameters of this model.
DifferentiableStatisticalModel.getESS() * DifferentiableStatisticalModel.getLogNormalizationConstant() + Math.log( prior ).DifferentiableStatisticalModel.getESS(),
DifferentiableStatisticalModel.getLogNormalizationConstant()
public double[] getCurrentParameterValues()
throws Exception
DifferentiableSequenceScoredouble array of dimension
DifferentiableSequenceScore.getNumberOfParameters() containing the current parameter values.
If one likes to use these parameters to start an optimization it is
highly recommended to invoke
DifferentiableSequenceScore.initializeFunction(int, boolean, DataSet[], double[][]) before.
After an optimization this method can be used to get the current
parameter values.
Exception - if no parameters exist (yet)public String getInstanceName()
SequenceScore
public int getNumberOfParameters()
DifferentiableSequenceScoreDifferentiableSequenceScore. If the
number of parameters is not known yet, the method returns
DifferentiableSequenceScore.UNKNOWN.
DifferentiableSequenceScoreDifferentiableSequenceScore.UNKNOWN
public void initializeFunction(int index,
boolean freeParams,
DataSet[] data,
double[][] weights)
throws Exception
DifferentiableSequenceScoreDifferentiableSequenceScore.
index - the index of the class the DifferentiableSequenceScore modelsfreeParams - indicates whether the (reduced) parameterization is useddata - the data setsweights - the weights of the sequences in the data sets
Exception - if something went wrongpublic void initializeUniformly()
DurationDiffSM
initializeUniformly in class DurationDiffSM
public void initializeFunctionRandomly(boolean freeParams)
throws Exception
DifferentiableSequenceScoreDifferentiableSequenceScore randomly. It has to
create the underlying structure of the DifferentiableSequenceScore.
freeParams - indicates whether the (reduced) parameterization is used
Exception - if something went wrongpublic boolean isInitialized()
SequenceScoreSequenceScore.getLogScoreFor(Sequence).
true if the instance is initialized, false
otherwisepublic boolean isNormalized()
DifferentiableStatisticalModelfalse.
isNormalized in interface DifferentiableStatisticalModelisNormalized in class AbstractDifferentiableStatisticalModeltrue if the implemented score is already normalized
to 1, false otherwise
public void setParameters(double[] params,
int start)
DifferentiableSequenceScoreparams between start and
start + DifferentiableSequenceScore.getNumberOfParameters() - 1
params - the new parametersstart - the start index in params
protected String getRNotation(String distributionName,
NumberFormat nf)
DurationDiffSM
getRNotation in class DurationDiffSMdistributionName - the name of the distribution, e.g., "p"nf - the NumberFormat to be used, can be null
REnvironmentpublic void modify(int delta)
DurationDiffSMAlphabetContainer. This might be necessary if the motif length changed.
modify in class DurationDiffSMdelta - the changeMutable.modify(int, int),
MutableMotifDiscoverer.modifyMotif(int, int, int)public int getNumberOfRecommendedStarts()
DifferentiableSequenceScore
getNumberOfRecommendedStarts in interface DifferentiableSequenceScoregetNumberOfRecommendedStarts in class AbstractDifferentiableSequenceScore
protected void fromXML(StringBuffer rep)
throws NonParsableException
AbstractDifferentiableSequenceScoreStorable
interface to create a scoring function from a StringBuffer.
fromXML in class DurationDiffSMrep - the XML representation as StringBuffer
NonParsableException - if the StringBuffer could not be parsedAbstractDifferentiableSequenceScore.AbstractDifferentiableSequenceScore(StringBuffer)public StringBuffer toXML()
StorableStringBuffer of an
instance of the implementing class.
toXML in interface StorabletoXML in class DurationDiffSM
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||