|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| 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.SkewNormalLikeScoringFunction
public class SkewNormalLikeScoringFunction
This class implements a skew normal like discrete truncated distribution.
| 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 | |
|---|---|
SkewNormalLikeScoringFunction(int min,
int max,
boolean trainMean,
double hyperMeanMean,
double hyperMeanSigma,
boolean trainPrecision,
double hyperPrec1,
double hyperPrec2,
boolean trainSkew,
double hyperSkewMean,
double hyperSkewStdev,
int starts)
This is the constructor that allows the most flexible handling of the parameters. |
|
SkewNormalLikeScoringFunction(int min,
int max,
double param0,
double param1,
double param2)
This is the main constructor if the parameters are fixed. |
|
SkewNormalLikeScoringFunction(StringBuffer source)
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. |
SkewNormalLikeScoringFunction |
clone()
Creates a clone (deep copy) of the current ScoringFunction
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
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. |
int |
getNumberOfRecommendedStarts()
This method returns the number of recommended optimization starts. |
protected String |
getRNotation(String distributionName)
This method returns the distribution in R notation. |
void |
initializeFunction(int index,
boolean freeParams,
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 |
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 + |
void |
setParameters(double par0,
double par1,
double par2)
this method can be used to set the parameters even if the parameters are not allowed to be optimized. |
StringBuffer |
toXML()
This method returns an XML representation as StringBuffer of an
instance of the implementing class. |
| Methods inherited from class de.jstacs.scoringFunctions.mix.motifSearch.DurationScoringFunction |
|---|
getEss, getLogNormalizationConstant, getLogPartialNormalizationConstant, getMax, getMin, getNumberOfPossibilities, getSizeOfEventSpaceForRandomVariablesOfParameter, isPossible, next, reset, toString |
| Methods inherited from class de.jstacs.scoringFunctions.mix.motifSearch.PositionScoringFunction |
|---|
getInternalPosition, getLogScore, getLogScoreAndPartialDerivation, getLogScoreAndPartialDerivationForInternal, getLogScoreForInternal, getValuesFromSequence |
| Methods inherited from class de.jstacs.scoringFunctions.AbstractNormalizableScoringFunction |
|---|
getAlphabetContainer, getInitialClassParam, getLength, getLogScore, getLogScoreAndPartialDerivation, getNumberOfStarts, isNormalized |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SkewNormalLikeScoringFunction(int min,
int max,
double param0,
double param1,
double param2)
min - the minimal valuemax - the maximal valueparam0 - the fixed parameter value for the first parameter (mean)param1 - the fixed parameter value for the second parameter (precision)param2 - the fixed parameter value for the third parameter (skew)
public SkewNormalLikeScoringFunction(int min,
int max,
boolean trainMean,
double hyperMeanMean,
double hyperMeanSigma,
boolean trainPrecision,
double hyperPrec1,
double hyperPrec2,
boolean trainSkew,
double hyperSkewMean,
double hyperSkewStdev,
int starts)
min - the minimal valuemax - the maximal valuetrainMean - a switch whether to optimize the first parameterhyperMeanMean - the mean hyper parameter for the first parameterhyperMeanSigma - the standard deviation hyper parameter for the first parametertrainPrecision - a switch whether to optimize the second parameterhyperPrec1 - the first hyper parameter for the precision (first parameter of the transformed gamma density);
this is value is used to determine the ess: hyperPrec1 = 0.5*esshyperPrec2 - the second hyper parameter for the precision (second parameter of the transformed gamma density)trainSkew - a switch whether to optimize the third parameterhyperSkewMean - the mean hyper parameter for the third parameterhyperSkewStdev - the standard deviation hyper parameter for the third parameterstarts - the number of recommended starts
public SkewNormalLikeScoringFunction(StringBuffer source)
throws NonParsableException
Storable. Creates a new
SkewNormalLikeScoringFunction out of a StringBuffer.
source - the XML representation as StringBuffer
NonParsableException - if the XML representation could not be parsed| Method Detail |
|---|
public SkewNormalLikeScoringFunction clone()
throws CloneNotSupportedException
ScoringFunctionScoringFunction
instance.
clone in interface ScoringFunctionclone in class PositionScoringFunctionScoringFunction
CloneNotSupportedException - if something went wrong while cloning the
ScoringFunction
public void initializeFunction(int index,
boolean freeParams,
Sample[] data,
double[][] weights)
throws Exception
ScoringFunctionScoringFunction.
index - the index of the class the ScoringFunction modelsfreeParams - indicates whether the (reduced) parameterization is useddata - the samplesweights - the weights of the sequences in the samples
Exception - if something went wrong
public void adjust(int[] length,
double[] weight)
DurationScoringFunction
adjust in class DurationScoringFunctionlength - an array containing length valuesweight - an array containing corresponding weight values
public void initializeFunctionRandomly(boolean freeParams)
throws Exception
ScoringFunctionScoringFunction randomly. It has to
create the underlying structure of the ScoringFunction.
freeParams - indicates whether the (reduced) parameterization is used
Exception - if something went wrong
protected void fromXML(StringBuffer rep)
throws NonParsableException
AbstractNormalizableScoringFunctionStorable
interface to create a scoring function from a StringBuffer.
fromXML in class DurationScoringFunctionrep - the XML representation as StringBuffer
NonParsableException - if the StringBuffer could not be parsedAbstractNormalizableScoringFunction.AbstractNormalizableScoringFunction(StringBuffer)public String getInstanceName()
ScoringFunction
public double[] getCurrentParameterValues()
throws Exception
ScoringFunctiondouble 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 double getLogScore(int... values)
PositionScoringFunction
getLogScore in class PositionScoringFunctionvalues - the values
public double getLogScoreAndPartialDerivation(IntList indices,
DoubleList partialDer,
int... values)
PositionScoringFunction
getLogScoreAndPartialDerivation in class PositionScoringFunctionindices - a list for the indices of the parameterspartialDer - a list of the partial derivationsvalues - the values
public int getNumberOfParameters()
ScoringFunctionScoringFunction. If the
number of parameters is not known yet, the method returns
ScoringFunction.UNKNOWN.
ScoringFunctionScoringFunction.UNKNOWN
public void setParameters(double[] params,
int start)
ScoringFunctionparams between start and
start + ScoringFunction.getNumberOfParameters() - 1
params - the new parametersstart - the start index in params
public void setParameters(double par0,
double par1,
double par2)
par0 - the first parameter (for the mean or maximum)par1 - the second parameter (for the precision)par2 - the third parameter (for the skew)public StringBuffer toXML()
StorableStringBuffer of an
instance of the implementing class.
toXML in interface StorabletoXML in class DurationScoringFunctionprotected String getRNotation(String distributionName)
DurationScoringFunction
getRNotation in class DurationScoringFunctiondistributionName - the name of the distribution, e.g., "p"
REnvironmentpublic 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)
throws Exception
NormalizableScoringFunctionNormalizableScoringFunction.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 gradientsNormalizableScoringFunction.getLogPriorTerm()public boolean isInitialized()
ScoringFunctionScoringFunction.initializeFunction(int, boolean, Sample[], double[][]).
true if the model is initialized, false
otherwisepublic boolean isNormalized()
NormalizableScoringFunctionfalse.
isNormalized in interface NormalizableScoringFunctionisNormalized in class AbstractNormalizableScoringFunctiontrue if the implemented score is already normalized
to 1, false otherwisepublic void initializeUniformly()
DurationScoringFunction
initializeUniformly in class DurationScoringFunctionpublic void modify(int delta)
DurationScoringFunctionAlphabetContainer. This might be necessary if the motif length changed.
modify in class DurationScoringFunctiondelta - the changeMutable.modify(int, int),
MutableMotifDiscoverer.modifyMotif(int, int, int)public int getNumberOfRecommendedStarts()
ScoringFunction
getNumberOfRecommendedStarts in interface ScoringFunctiongetNumberOfRecommendedStarts in class AbstractNormalizableScoringFunction
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||