Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.jstacs.scoringFunctions.mix.motifSearch
Class SkewNormalLikeScoringFunction

    java.lang.Object
      de.jstacs.scoringFunctions.AbstractNormalizableScoringFunction
          de.jstacs.scoringFunctions.mix.motifSearch.PositionScoringFunction
              de.jstacs.scoringFunctions.mix.motifSearch.DurationScoringFunction
                  de.jstacs.scoringFunctions.mix.motifSearch.SkewNormalLikeScoringFunction

All Implemented Interfaces:
  NormalizableScoringFunction, ScoringFunction, Storable, Cloneable

    public class SkewNormalLikeScoringFunction

extends DurationScoringFunction

This class implements a skew normal like discrete truncated distribution.

Author:
  Jens Keilwagen

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 ``NormalizableScoringFunction.getEss()` * `NormalizableScoringFunction.getLogNormalizationConstant()` + Math.log( prior )` 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 + `ScoringFunction.getNumberOfParameters()` - 1`
`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

### SkewNormalLikeScoringFunction

    public SkewNormalLikeScoringFunction(int min,
                                         int max,
                                         double param0,
                                         double param1,
                                         double param2)

  This is the main constructor if the parameters are fixed.

  Parameters:
    `min` - the minimal value
    `max` - the maximal value
    `param0` - 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)

### SkewNormalLikeScoringFunction

    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)

  This is the constructor that allows the most flexible handling of the parameters.

  Parameters:
    `min` - the minimal value
    `max` - the maximal value
    `trainMean` - a switch whether to optimize the first parameter
    `hyperMeanMean` - the mean hyper parameter for the first parameter
    `hyperMeanSigma` - the standard deviation hyper parameter for the first parameter
    `trainPrecision` - a switch whether to optimize the second parameter
    `hyperPrec1` - 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*ess`
    `hyperPrec2` - the second hyper parameter for the precision (second parameter of the transformed gamma density)
    `trainSkew` - a switch whether to optimize the third parameter
    `hyperSkewMean` - the mean hyper parameter for the third parameter
    `hyperSkewStdev` - the standard deviation hyper parameter for the third parameter
    `starts` - the number of recommended starts

### SkewNormalLikeScoringFunction

    public SkewNormalLikeScoringFunction(StringBuffer source)
                                  throws NonParsableException

  This is the constructor for `Storable`. Creates a new `SkewNormalLikeScoringFunction` out of a `StringBuffer`.

  Parameters:
    `source` - the XML representation as `StringBuffer`
  Throws:
    `NonParsableException` - if the XML representation could not be parsed

Method Detail

### clone

    public SkewNormalLikeScoringFunction clone()
                                        throws CloneNotSupportedException

  Description copied from interface: `ScoringFunction`
  Creates a clone (deep copy) of the current `ScoringFunction` instance.

  Specified by:
    `clone` in interface `ScoringFunction`
  Overrides:
    `clone` in class `PositionScoringFunction`
  Returns:
    the cloned instance of the current `ScoringFunction`
  Throws:
    `CloneNotSupportedException` - if something went wrong while cloning the `ScoringFunction`

### initializeFunction

    public void initializeFunction(int index,
                                   boolean freeParams,
                                   Sample[] data,
                                   double[][] weights)
                            throws Exception

  Description copied from interface: `ScoringFunction`
  This method creates the underlying structure of the `ScoringFunction`.

  Parameters:
    `index` - the index of the class the `ScoringFunction` models
    `freeParams` - indicates whether the (reduced) parameterization is used
    `data` - the samples
    `weights` - the weights of the sequences in the samples
  Throws:
    `Exception` - if something went wrong

### adjust

    public void adjust(int[] length,
                       double[] weight)

  Description copied from class: `DurationScoringFunction`
  This method adjust the parameter based on the given statistic.

  Specified by:
    `adjust` in class `DurationScoringFunction`
  Parameters:
    `length` - an array containing length values
    `weight` - an array containing corresponding weight values

### initializeFunctionRandomly

    public void initializeFunctionRandomly(boolean freeParams)
                                    throws Exception

  Description copied from interface: `ScoringFunction`
  This method initializes the `ScoringFunction` randomly. It has to create the underlying structure of the `ScoringFunction`.

  Parameters:
    `freeParams` - indicates whether the (reduced) parameterization is used
  Throws:
    `Exception` - if something went wrong

### fromXML

    protected void fromXML(StringBuffer rep)
                    throws NonParsableException

  Description copied from class: `AbstractNormalizableScoringFunction`
  This method is called in the constructor for the `Storable` interface to create a scoring function from a `StringBuffer`.

  Overrides:
    `fromXML` in class `DurationScoringFunction`
  Parameters:
    `rep` - the XML representation as `StringBuffer`
  Throws:
    `NonParsableException` - if the `StringBuffer` could not be parsed
  See Also:
    `AbstractNormalizableScoringFunction.AbstractNormalizableScoringFunction(StringBuffer)`

### getInstanceName

    public String getInstanceName()

  Description copied from interface: `ScoringFunction`
  Returns a short instance name.

  Returns:
    a short instance name

### getCurrentParameterValues

    public double[] getCurrentParameterValues()
                                       throws Exception

  Description copied from interface: `ScoringFunction`
  Returns a `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.

  Returns:
    the current parameter values
  Throws:
    `Exception` - if no parameters exist (yet)

### getLogScore

    public double getLogScore(int... values)

  Description copied from class: `PositionScoringFunction`
  This method enables the user to get the log-score without using a sequence object.

  Specified by:
    `getLogScore` in class `PositionScoringFunction`
  Parameters:
    `values` - the values
  Returns:
    the score

### getLogScoreAndPartialDerivation

    public double getLogScoreAndPartialDerivation(IntList indices,
                                                  DoubleList partialDer,
                                                  int... values)

  Description copied from class: `PositionScoringFunction`
  This method enables the user to get the log-score and the partial derivations without using a sequence object.

  Specified by:
    `getLogScoreAndPartialDerivation` in class `PositionScoringFunction`
  Parameters:
    `indices` - a list for the indices of the parameters
    `partialDer` - a list of the partial derivations
    `values` - the values
  Returns:
    the score

### getNumberOfParameters

    public int getNumberOfParameters()

  Description copied from interface: `ScoringFunction`
  Returns the number of parameters in this `ScoringFunction`. If the number of parameters is not known yet, the method returns `ScoringFunction.UNKNOWN`.

  Returns:
    the number of parameters in this `ScoringFunction`
  See Also:
    `ScoringFunction.UNKNOWN`

### setParameters

    public void setParameters(double[] params,
                              int start)

  Description copied from interface: `ScoringFunction`
  This method sets the internal parameters to the values of `params` between `start` and `start + `ScoringFunction.getNumberOfParameters()` - 1`

  Parameters:
    `params` - the new parameters
    `start` - the start index in `params`

### setParameters

    public 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.

  Parameters:
    `par0` - the first parameter (for the mean or maximum)
    `par1` - the second parameter (for the precision)
    `par2` - the third parameter (for the skew)

### toXML

    public StringBuffer toXML()

  Description copied from interface: `Storable`
  This method returns an XML representation as `StringBuffer` of an instance of the implementing class.

  Specified by:
    `toXML` in interface `Storable`
  Overrides:
    `toXML` in class `DurationScoringFunction`
  Returns:
    the XML representation

### getRNotation

    protected String getRNotation(String distributionName)

  Description copied from class: `DurationScoringFunction`
  This method returns the distribution in R notation.

  Specified by:
    `getRNotation` in class `DurationScoringFunction`
  Parameters:
    `distributionName` - the name of the distribution, e.g., "p"
  Returns:
    the distribution in R notation
  See Also:
    `REnvironment`

### getLogPriorTerm

    public double getLogPriorTerm()

  Description copied from interface: `NormalizableScoringFunction`
  This method computes a value that is proportional to

  ``NormalizableScoringFunction.getEss()` * `NormalizableScoringFunction.getLogNormalizationConstant()` + Math.log( prior )`

  where `prior` is the prior for the parameters of this model.

  Returns:
    a value that is proportional to ``NormalizableScoringFunction.getEss()` * `NormalizableScoringFunction.getLogNormalizationConstant()` + Math.log( prior ).`
  See Also:
    `NormalizableScoringFunction.getEss()`, `NormalizableScoringFunction.getLogNormalizationConstant()`

### addGradientOfLogPriorTerm

    public void addGradientOfLogPriorTerm(double[] grad,
                                          int start)
                                   throws Exception

  Description copied from interface: `NormalizableScoringFunction`
  This method computes the gradient of `NormalizableScoringFunction.getLogPriorTerm()` for each parameter of this model. The results are added to the array `grad` beginning at index `start`.

  Parameters:
    `grad` - the array of gradients
    `start` - the start index in the `grad` array, where the partial derivations for the parameters of this models shall be entered
  Throws:
    `Exception` - if something went wrong with the computing of the gradients
  See Also:
    `NormalizableScoringFunction.getLogPriorTerm()`

### isInitialized

    public boolean isInitialized()

  Description copied from interface: `ScoringFunction`
  This method can be used to determine whether the model is initialized. If the model is not initialized you should invoke the method `ScoringFunction.initializeFunction(int, boolean, Sample[], double[][])`.

  Returns:
    `true` if the model is initialized, `false` otherwise

### isNormalized

    public boolean isNormalized()

  Description copied from interface: `NormalizableScoringFunction`
  This method indicates whether the implemented score is already normalized to 1 or not. The standard implementation returns `false`.

  Specified by:
    `isNormalized` in interface `NormalizableScoringFunction`
  Overrides:
    `isNormalized` in class `AbstractNormalizableScoringFunction`
  Returns:
    `true` if the implemented score is already normalized to 1, `false` otherwise

### initializeUniformly

    public void initializeUniformly()

  Description copied from class: `DurationScoringFunction`
  This method set special parameters that lead to an uniform distribution.

  Specified by:
    `initializeUniformly` in class `DurationScoringFunction`

### modify

    public void modify(int delta)

  Description copied from class: `DurationScoringFunction`
  This method modifies the underlying `AlphabetContainer`. This might be necessary if the motif length changed.

  Overrides:
    `modify` in class `DurationScoringFunction`
  Parameters:
    `delta` - the change
  See Also:
    `Mutable.modify(int, int)`, `MutableMotifDiscoverer.modifyMotif(int, int, int)`

### getNumberOfRecommendedStarts

    public int getNumberOfRecommendedStarts()

  Description copied from interface: `ScoringFunction`
  This method returns the number of recommended optimization starts. The standard implementation returns 1.

  Specified by:
    `getNumberOfRecommendedStarts` in interface `ScoringFunction`
  Overrides:
    `getNumberOfRecommendedStarts` in class `AbstractNormalizableScoringFunction`
  Returns:
    the number of recommended optimization starts

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD