|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.scoringFunctions.AbstractNormalizableScoringFunction
de.jstacs.scoringFunctions.mix.motifSearch.PositionScoringFunction
de.jstacs.scoringFunctions.mix.motifSearch.DurationScoringFunction
de.jstacs.scoringFunctions.mix.motifSearch.UniformDurationScoringFunction
public final class UniformDurationScoringFunction
This scoring function implements a uniform distribution for positions. The class has no parameters, so the distribution does not change and it is possible to save parameters in an optimization.
Field Summary |
---|
Fields inherited from class de.jstacs.scoringFunctions.mix.motifSearch.DurationScoringFunction |
---|
delta, ess, max, min |
Fields inherited from class de.jstacs.scoringFunctions.mix.motifSearch.PositionScoringFunction |
---|
internal |
Fields inherited from class de.jstacs.scoringFunctions.AbstractNormalizableScoringFunction |
---|
alphabets, length, r |
Fields inherited from interface de.jstacs.scoringFunctions.ScoringFunction |
---|
UNKNOWN |
Constructor Summary | |
---|---|
UniformDurationScoringFunction(int min,
int max)
This is the main constructor that creates an instance for the given interval. |
|
UniformDurationScoringFunction(int min,
int max,
double ess)
This is the main constructor that creates an instance for the given interval and given ESS. |
|
UniformDurationScoringFunction(StringBuffer b)
This is the constructor for Storable . |
Method Summary | |
---|---|
void |
addGradientOfLogPriorTerm(double[] grad,
int start)
This method computes the gradient of NormalizableScoringFunction.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
ScoringFunction.getNumberOfParameters() containing the current parameter values. |
String |
getInstanceName()
Returns a short instance name. |
double |
getLogPriorTerm()
This method computes a value that is proportional to
where prior is the prior for the parameters of this model. |
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 ScoringFunction . |
protected String |
getRNotation(String distributionName)
This method returns the distribution in R notation. |
void |
initializeFunction(int index,
boolean meila,
Sample[] data,
double[][] weights)
This method creates the underlying structure of the ScoringFunction . |
void |
initializeFunctionRandomly(boolean freeParams)
This method initializes the ScoringFunction 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 model is initialized. |
boolean |
isNormalized()
This method indicates whether the implemented score is already normalized to 1 or not. |
void |
setParameters(double[] params,
int start)
This method sets the internal parameters to the values of params between start and
start + |
Methods inherited from class de.jstacs.scoringFunctions.mix.motifSearch.DurationScoringFunction |
---|
fromXML, getEss, getLogNormalizationConstant, getLogPartialNormalizationConstant, getMax, getMin, getNumberOfPossibilities, getSizeOfEventSpaceForRandomVariablesOfParameter, isPossible, modify, next, reset, toString, toXML |
Methods inherited from class de.jstacs.scoringFunctions.mix.motifSearch.PositionScoringFunction |
---|
clone, getInternalPosition, getLogScore, getLogScoreAndPartialDerivation, getLogScoreAndPartialDerivationForInternal, getLogScoreForInternal, getValuesFromSequence |
Methods inherited from class de.jstacs.scoringFunctions.AbstractNormalizableScoringFunction |
---|
getAlphabetContainer, getInitialClassParam, getLength, getLogScore, getLogScoreAndPartialDerivation, getNumberOfRecommendedStarts, getNumberOfStarts, isNormalized |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public UniformDurationScoringFunction(int min, int max)
min
- the minimal valuemax
- the maximal valuepublic UniformDurationScoringFunction(int min, int max, double ess)
min
- the minimal valuemax
- the maximal valueess
- the equivalent sample size (used for the class probability)public UniformDurationScoringFunction(StringBuffer b) throws NonParsableException
Storable
. Creates a new
UniformDurationScoringFunction
out of a StringBuffer
.
b
- the XML representation as StringBuffer
NonParsableException
- if the XML representation could not be parsedMethod Detail |
---|
public String getInstanceName()
ScoringFunction
public int getNumberOfParameters()
ScoringFunction
ScoringFunction
. If the
number of parameters is not known yet, the method returns
ScoringFunction.UNKNOWN
.
ScoringFunction
ScoringFunction.UNKNOWN
public void setParameters(double[] params, int start)
ScoringFunction
params
between start
and
start + ScoringFunction.getNumberOfParameters()
- 1
params
- the new parametersstart
- the start index in params
public void initializeFunction(int index, boolean meila, Sample[] data, double[][] weights)
ScoringFunction
ScoringFunction
.
index
- the index of the class the ScoringFunction
modelsmeila
- indicates whether the (reduced) parameterization is useddata
- the samplesweights
- the weights of the sequences in the samplesprotected String getRNotation(String distributionName)
DurationScoringFunction
getRNotation
in class DurationScoringFunction
distributionName
- the name of the distribution, e.g., "p"
REnvironment
public double getLogPriorTerm()
NormalizableScoringFunction
NormalizableScoringFunction.getEss()
* NormalizableScoringFunction.getLogNormalizationConstant()
+ Math.log( prior )
prior
is the prior for the parameters of this model.
NormalizableScoringFunction.getEss()
* NormalizableScoringFunction.getLogNormalizationConstant()
+ Math.log( prior ).
NormalizableScoringFunction.getEss()
,
NormalizableScoringFunction.getLogNormalizationConstant()
public void addGradientOfLogPriorTerm(double[] grad, int start)
NormalizableScoringFunction
NormalizableScoringFunction.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
enteredNormalizableScoringFunction.getLogPriorTerm()
public double getLogScore(int... values)
PositionScoringFunction
getLogScore
in class PositionScoringFunction
values
- the values
public double getLogScoreAndPartialDerivation(IntList indices, DoubleList partialDer, int... values)
PositionScoringFunction
getLogScoreAndPartialDerivation
in class PositionScoringFunction
indices
- a list for the indices of the parameterspartialDer
- a list of the partial derivationsvalues
- the values
public void drawPosition(int[] positions)
positions
- an array for the result.public double[] getCurrentParameterValues() throws Exception
ScoringFunction
double
array of dimension
ScoringFunction.getNumberOfParameters()
containing the current parameter values.
If one likes to use these parameters to start an optimization it is
highly recommended to invoke
ScoringFunction.initializeFunction(int, boolean, Sample[], 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()
ScoringFunction
ScoringFunction.initializeFunction(int, boolean, Sample[], double[][])
.
true
if the model is initialized, false
otherwisepublic boolean isNormalized()
NormalizableScoringFunction
false
.
isNormalized
in interface NormalizableScoringFunction
isNormalized
in class AbstractNormalizableScoringFunction
true
if the implemented score is already normalized
to 1, false
otherwisepublic void initializeFunctionRandomly(boolean freeParams) throws Exception
ScoringFunction
ScoringFunction
randomly. It has to
create the underlying structure of the ScoringFunction
.
freeParams
- indicates whether the (reduced) parameterization is used
Exception
- if something went wrongpublic void initializeUniformly()
DurationScoringFunction
initializeUniformly
in class DurationScoringFunction
public void adjust(int[] length, double[] weight)
DurationScoringFunction
adjust
in class DurationScoringFunction
length
- an array containing length valuesweight
- an array containing corresponding weight values
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |