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.motifDiscovery
Class MutableMotifDiscovererToolbox

    java.lang.Object
      de.jstacs.motifDiscovery.MotifDiscovererToolBox
          de.jstacs.motifDiscovery.MutableMotifDiscovererToolbox

    public final class MutableMotifDiscovererToolbox

extends MotifDiscovererToolBox

This class contains some important methods for the initiation and optimization of `MutableMotifDiscoverer`.

Author:
  Jan Grau, Jens Keilwagen

Nested Class Summary
`static class` | `MutableMotifDiscovererToolbox.InitMethodForScoringFunction` This enum defines some constants for the method `getSortedInitialParameters(Sample[], ScoringFunction[], InitMethodForScoringFunction[], OptimizableFunction, int, SafeOutputStream)`.

Constructor Summary
`MutableMotifDiscovererToolbox()`

Method Summary
`static void` | `clearHistoryArray(History[][] history)` This method clears all elements of an History-array, so that it can be used again.
`static History[][]` | `createHistoryArray(ScoringFunction[] funs, History template)` This method creates a History-array that can be used in an optimization.
`static int[][]` | `createMinimalNewLengthArray(ScoringFunction[] funs)` This method creates a minimalNewLength-array that can be used in an optimization.
`static boolean` | `doHeuristicSteps(ScoringFunction[] funs, Sample[] data, double[][] weights, OptimizableFunction opt, SafeOutputStream out, boolean breakOnChanged, History[][] hist, int[][] minimalNewLength)` This method tries to make some heuristic step if at least one `MutableMotifDiscovererToolbox.InitMethodForScoringFunction` is a `MutableMotifDiscoverer`.
`static Sequence` | `enumerate(Sample[] data, ScoringFunction[] funs, int classIndex, int motifIndex, double weight, OptimizableFunction opt, OutputStream out)` This method allows to enumerate all possible seeds for a motif in the `HiddenMotifsMixture` of a specific class.
`static ComparableElement<double[],Double>[]` | `getSortedInitialParameters(Sample[] data, ScoringFunction[] funs, MutableMotifDiscovererToolbox.InitMethodForScoringFunction[] init, OptimizableFunction opt, int n, SafeOutputStream stream)` This method allows to initialize the `MutableMotifDiscovererToolbox.InitMethodForScoringFunction` using different `MutableMotifDiscovererToolbox.InitMethodForScoringFunction`.
`static double[][]` | `optimize(ScoringFunction[] funs, OptimizableFunction opt, byte algorithm, double eps, double linEps, StartDistanceForecaster startDistance, SafeOutputStream out, boolean breakOnChanged, History[][] hist, int[][] minimalNewLength, OptimizableFunction.KindOfParameter plugIn)` This method tries to optimize the problem at hand as good as possible.
`static double[][]` | `optimize(ScoringFunction[] funs, OptimizableFunction opt, byte algorithm, double eps, double linEps, StartDistanceForecaster startDistance, SafeOutputStream out, boolean breakOnChanged, History template, OptimizableFunction.KindOfParameter plugIn)` This method tries to optimize the problem at hand as good as possible.

Methods inherited from class de.jstacs.motifDiscovery.MotifDiscovererToolBox
`plot, plotAndAnnotate`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MutableMotifDiscovererToolbox

    public MutableMotifDiscovererToolbox()

Method Detail

### enumerate

    public static Sequence enumerate(Sample[] data,
                                     ScoringFunction[] funs,
                                     int classIndex,
                                     int motifIndex,
                                     double weight,
                                     OptimizableFunction opt,
                                     OutputStream out)
                              throws Exception

  This method allows to enumerate all possible seeds for a motif in the `HiddenMotifsMixture` of a specific class.

  Parameters:
    `data` - the data
    `funs` - the `MutableMotifDiscovererToolbox.InitMethodForScoringFunction`s
    `classIndex` - the index of the class
    `motifIndex` - the index of the motif in the `HiddenMotifsMixture`
    `weight` - the weight of the seed `Sequence`
    `opt` - the objective function
    `out` - a stream that allows to write some output if necessary
  Returns:
    the best `Sequence` with respect to the `OptimizableFunction`
  Throws:
    `Exception` - if something went wrong

### getSortedInitialParameters

    public static ComparableElement<double[],Double>[] getSortedInitialParameters(Sample[] data,
                                                                                  ScoringFunction[] funs,
                                                                                  MutableMotifDiscovererToolbox.InitMethodForScoringFunction[] init,
                                                                                  OptimizableFunction opt,
                                                                                  int n,
                                                                                  SafeOutputStream stream)
                                                                           throws Exception

  This method allows to initialize the `MutableMotifDiscovererToolbox.InitMethodForScoringFunction` using different `MutableMotifDiscovererToolbox.InitMethodForScoringFunction`. It returns an array of `ComparableElement`s that contain the parameters and the

  Parameters:
    `data` - the data
    `funs` - the `MutableMotifDiscovererToolbox.InitMethodForScoringFunction`
    `init` - the specific `MutableMotifDiscovererToolbox.InitMethodForScoringFunction`, the entries correspond one to one to those of `fun`
    `opt` - the objective function
    `n` - the number of initializations
    `stream` - a stream that allows to write some output if necessary
  Returns:
    a sorted array containing `ComparableElement`s of parameter arrays and corresponding values of the `OptimizableFunction`
  Throws:
    `Exception` - if something went wrong

### createMinimalNewLengthArray

    public static int[][] createMinimalNewLengthArray(ScoringFunction[] funs)

  This method creates a minimalNewLength-array that can be used in an optimization.

  Parameters:
    `funs` - the ScoringFunctions used in an optimization
  Returns:
    an minimalNewLength-array for the given ScoringFunctions

### createHistoryArray

    public static History[][] createHistoryArray(ScoringFunction[] funs,
                                                 History template)
                                          throws CloneNotSupportedException

  This method creates a History-array that can be used in an optimization.

  Parameters:
    `funs` - the ScoringFunctions used in an optimization
    `template` - the template history instance
  Returns:
    an History-array for the given ScoringFunctions
  Throws:
    `CloneNotSupportedException` - if the t`template` could not be cloned

### clearHistoryArray

    public static void clearHistoryArray(History[][] history)

  This method clears all elements of an History-array, so that it can be used again.

  Parameters:
    `history` - the array

### optimize

    public static double[][] optimize(ScoringFunction[] funs,
                                      OptimizableFunction opt,
                                      byte algorithm,
                                      double eps,
                                      double linEps,
                                      StartDistanceForecaster startDistance,
                                      SafeOutputStream out,
                                      boolean breakOnChanged,
                                      History template,
                                      OptimizableFunction.KindOfParameter plugIn)
                               throws Exception

  This method tries to optimize the problem at hand as good as possible. If the optimization uses `MutableMotifDiscoverer`s it tries to perform modify operations as long as they seem to be promising.

  Parameters:
    `funs` - the `MutableMotifDiscovererToolbox.InitMethodForScoringFunction`
    `opt` - the `OptimizableFunction`
    `algorithm` - used for the optimization
    `eps` - used for the optimization
    `linEps` - used for the optimization
    `startDistance` - used for the optimization
    `out` - an stream that allows to obtain some information while optimization
    `breakOnChanged` - a switch that decides whether a new optimization should be started after one successful modify or after all motifs have been tried to modify.
    `template` - a history instance used to build an array with this instance
    `plugIn` - a switch whether to take the internal parameters or not
  Returns:
    the optimized value (res[0][0]) and the array for the class parameters (res[1])
  Throws:
    `Exception` - if something went wrong while optimization
  See Also:
    `clearHistoryArray(de.jstacs.motifDiscovery.history.History[][])`, `optimize(de.jstacs.scoringFunctions.ScoringFunction[], de.jstacs.classifier.scoringFunctionBased.OptimizableFunction, byte, double, double, de.jstacs.algorithms.optimization.StartDistanceForecaster, de.jstacs.utils.SafeOutputStream, boolean, de.jstacs.motifDiscovery.history.History[][], int[][], de.jstacs.classifier.scoringFunctionBased.OptimizableFunction.KindOfParameter)`

### optimize

    public static double[][] optimize(ScoringFunction[] funs,
                                      OptimizableFunction opt,
                                      byte algorithm,
                                      double eps,
                                      double linEps,
                                      StartDistanceForecaster startDistance,
                                      SafeOutputStream out,
                                      boolean breakOnChanged,
                                      History[][] hist,
                                      int[][] minimalNewLength,
                                      OptimizableFunction.KindOfParameter plugIn)
                               throws Exception

  This method tries to optimize the problem at hand as good as possible. If the optimization uses `MutableMotifDiscoverer`s it tries to perform modify operations as long as they seem to be promising.

  Parameters:
    `funs` - the `MutableMotifDiscovererToolbox.InitMethodForScoringFunction`
    `opt` - the `OptimizableFunction`
    `algorithm` - used for the optimization
    `eps` - used for the optimization
    `linEps` - used for the optimization
    `startDistance` - used for the optimization
    `out` - an stream that allows to obtain some information while optimization
    `breakOnChanged` - a switch that decides whether a new optimization should be started after one successful modify or after all motifs have been tried to modify.
    `hist` - an array that is used to check whether a modify-operation can be performed
    `minimalNewLength` - the minimal new length for each motif in each class, that will be used in an expand if the motif was shortened before
    `plugIn` - a switch whether to take the internal parameters or not
  Returns:
    the optimized value (res[0][0]) and the array for the class parameters (res[1])
  Throws:
    `Exception` - if something went wrong while optimization

### doHeuristicSteps

    public static boolean doHeuristicSteps(ScoringFunction[] funs,
                                           Sample[] data,
                                           double[][] weights,
                                           OptimizableFunction opt,
                                           SafeOutputStream out,
                                           boolean breakOnChanged,
                                           History[][] hist,
                                           int[][] minimalNewLength)
                                    throws Exception

  This method tries to make some heuristic step if at least one `MutableMotifDiscovererToolbox.InitMethodForScoringFunction` is a `MutableMotifDiscoverer`. These heuristic steps include shift, shrink, and expand as far as the user allows those operations by the `History` array.

  Parameters:
    `funs` - the `MutableMotifDiscovererToolbox.InitMethodForScoringFunction`
    `data` - array of `Sample` containing the data for each class
    `weights` - the weights corresponding to the `Sequence`s in `data`
    `opt` - the `OptimizableFunction`
    `out` - an stream that allows to obtain some information while optimization
    `breakOnChanged` - a switch that decides whether a new optimization should be started after one successful modify or after all motifs have been tried to modify.
    `hist` - an array that is used to check whether a modify-operation can be performed
    `minimalNewLength` - the minimal new length for each motif in each class, that will be used in an expand if the motif was shortened before
  Returns:
    `true` if some heuristic steps has been performed otherwise `false`
  Throws:
    `Exception` - if something went wrong

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