public final class UniformDurationDiffSM extends DurationDiffSM
delta, ess, max, min
internal
alphabets, length, r
UNKNOWN
Constructor and Description |
---|
UniformDurationDiffSM(int min,
int max)
This is the main constructor that creates an instance for the given interval.
|
UniformDurationDiffSM(int min,
int max,
double ess)
This is the main constructor that creates an instance for the given interval and given ESS.
|
UniformDurationDiffSM(StringBuffer b)
This is the constructor for
Storable . |
Modifier and Type | Method and Description |
---|---|
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.
|
void |
drawPosition(int[] positions)
This method draws from the distribution and returns the result in the given array.
|
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 . |
protected String |
getRNotation(String distributionName,
NumberFormat nf)
This method returns the distribution in R notation.
|
void |
initializeFunction(int index,
boolean meila,
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 + |
fromXML, getESS, getLogNormalizationConstant, getLogPartialNormalizationConstant, getMax, getMin, getNumberOfPossibilities, getSizeOfEventSpaceForRandomVariablesOfParameter, isPossible, next, reset, toString, toXML
clone, getInternalPosition, getLogScoreAndPartialDerivation, getLogScoreAndPartialDerivationForInternal, getLogScoreFor, getLogScoreForInternal, getValuesFromSequence
emitDataSet, getInitialClassParam, getLogProbFor, getLogProbFor, getLogProbFor, getLogScoreFor, getLogScoreFor, getMaximalMarkovOrder, isNormalized
getAlphabetContainer, getCharacteristics, getLength, getLogScoreAndPartialDerivation, getLogScoreAndPartialDerivation, getLogScoreFor, getLogScoreFor, getNumberOfRecommendedStarts, getNumberOfStarts, getNumericalCharacteristics, toString
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getLogScoreAndPartialDerivation, getLogScoreAndPartialDerivation, getNumberOfRecommendedStarts
getAlphabetContainer, getCharacteristics, getLength, getLogScoreFor, getLogScoreFor, getNumericalCharacteristics
public UniformDurationDiffSM(int min, int max)
min
- the minimal valuemax
- the maximal valuepublic UniformDurationDiffSM(int min, int max, double ess)
min
- the minimal valuemax
- the maximal valueess
- the equivalent sample size (used for the class probability)public UniformDurationDiffSM(StringBuffer b) throws NonParsableException
b
- the XML representation as StringBuffer
NonParsableException
- if the XML representation could not be parsedpublic void modify(int delta)
DurationDiffSM
AlphabetContainer
. This might be necessary if the motif length changed.modify
in class DurationDiffSM
delta
- the changeMutable.modify(int, int)
,
MutableMotifDiscoverer.modifyMotif(int, int, int)
public String getInstanceName()
SequenceScore
public int getNumberOfParameters()
DifferentiableSequenceScore
DifferentiableSequenceScore
. If the
number of parameters is not known yet, the method returns
DifferentiableSequenceScore.UNKNOWN
.DifferentiableSequenceScore
DifferentiableSequenceScore.UNKNOWN
public void setParameters(double[] params, int start)
DifferentiableSequenceScore
params
between start
and
start + DifferentiableSequenceScore.getNumberOfParameters()
- 1
params
- the new parametersstart
- the start index in params
public void initializeFunction(int index, boolean meila, DataSet[] data, double[][] weights)
DifferentiableSequenceScore
DifferentiableSequenceScore
.index
- the index of the class the DifferentiableSequenceScore
modelsmeila
- indicates whether the (reduced) parameterization is useddata
- the data setsweights
- the weights of the sequences in the data setsprotected String getRNotation(String distributionName, NumberFormat nf)
DurationDiffSM
getRNotation
in class DurationDiffSM
distributionName
- the name of the distribution, e.g., "p"nf
- the NumberFormat
to be used, can be null
REnvironment
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 void addGradientOfLogPriorTerm(double[] grad, int start)
DifferentiableStatisticalModel
DifferentiableStatisticalModel.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
enteredDifferentiableStatisticalModel.getLogPriorTerm()
public double getLogScore(int... values)
PositionDiffSM
getLogScore
in class PositionDiffSM
values
- the valuespublic double getLogScoreAndPartialDerivation(IntList indices, DoubleList partialDer, int... values)
PositionDiffSM
getLogScoreAndPartialDerivation
in class PositionDiffSM
indices
- a list for the indices of the parameterspartialDer
- a list of the partial derivationsvalues
- the valuespublic void drawPosition(int[] positions)
positions
- an array for the result.public double[] getCurrentParameterValues() throws Exception
DifferentiableSequenceScore
double
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 boolean isInitialized()
SequenceScore
SequenceScore.getLogScoreFor(Sequence)
.true
if the instance is initialized, false
otherwisepublic boolean isNormalized()
DifferentiableStatisticalModel
false
.isNormalized
in interface DifferentiableStatisticalModel
isNormalized
in class AbstractDifferentiableStatisticalModel
true
if the implemented score is already normalized
to 1, false
otherwisepublic void initializeFunctionRandomly(boolean freeParams) throws Exception
DifferentiableSequenceScore
DifferentiableSequenceScore
randomly. It has to
create the underlying structure of the DifferentiableSequenceScore
.freeParams
- indicates whether the (reduced) parameterization is usedException
- if something went wrongpublic void initializeUniformly()
DurationDiffSM
initializeUniformly
in class DurationDiffSM
public void adjust(int[] length, double[] weight)
DurationDiffSM
adjust
in class DurationDiffSM
length
- an array containing length valuesweight
- an array containing corresponding weight values