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.sequenceScores.statisticalModels.differentiable.mixture.motif
Class PositionDiffSM

    java.lang.Object
      de.jstacs.sequenceScores.differentiable.AbstractDifferentiableSequenceScore
          de.jstacs.sequenceScores.statisticalModels.differentiable.AbstractDifferentiableStatisticalModel
              de.jstacs.sequenceScores.statisticalModels.differentiable.mixture.motif.PositionDiffSM

All Implemented Interfaces:
  DifferentiableSequenceScore, SequenceScore, DifferentiableStatisticalModel, StatisticalModel, Storable, Cloneable

Direct Known Subclasses:
  DurationDiffSM

    public abstract class PositionDiffSM

extends AbstractDifferentiableStatisticalModel

This class implements a position scoring function that enables the user to get a score without using a Sequence object. It furthermore implements a kind of iterator that allows the user to iterate over all reasonable possibilities.

Author:
  Jens Keilwagen
See Also:
  `Sequence`, `reset()`, `next()`, `getLogScoreForInternal()`, `getLogScoreAndPartialDerivationForInternal(IntList, DoubleList)`

Field Summary
`protected int[]` | `internal` This array is used for some method of `DurationDiffSM` that use an internal memory

Fields inherited from class de.jstacs.sequenceScores.differentiable.AbstractDifferentiableSequenceScore
`alphabets, length, r`

Fields inherited from interface de.jstacs.sequenceScores.differentiable.DifferentiableSequenceScore
`UNKNOWN`

Constructor Summary
`protected` | `PositionDiffSM(AlphabetContainer con, int length)` This constructor allows create instance with more than one dimension.
`protected` | `PositionDiffSM(int min, int max)` This is the main constructor that creates the `AlphabetContainer` internally.
`protected` | `PositionDiffSM(StringBuffer source)` This is the constructor for `Storable`.

Method Summary
`PositionDiffSM` | `clone()` Creates a clone (deep copy) of the current `DifferentiableSequenceScore` instance.
`protected void` | `fromXML(StringBuffer xml)` This method is called in the constructor for the `Storable` interface to create a scoring function from a `StringBuffer`.
`void` | `getInternalPosition(int[] positions)` Copies the current value of the internal iterator in the given array.
`abstract double` | `getLogScore(int... values)` This method enables the user to get the log-score without using a sequence object.
`abstract 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.
`double` | `getLogScoreAndPartialDerivation(Sequence seq, int start, IntList indices, DoubleList partialDer)` Returns the logarithmic score for a `Sequence` beginning at position `start` in the `Sequence` and fills lists with the indices and the partial derivations.
`double` | `getLogScoreAndPartialDerivationForInternal(IntList indices, DoubleList partialDer)` This method enables the user to get the log-score and the partial derivations without using a sequence object by using the internal iterator.
`double` | `getLogScoreFor(Sequence seq, int start)` Returns the logarithmic score for the `Sequence` `seq` beginning at position `start` in the `Sequence`.
`double` | `getLogScoreForInternal()` This method enables the user to get the log-score without using a sequence object by using the internal iterator.
`protected int[]` | `getValuesFromSequence(Sequence seq, int start)` This method extracts the values form a sequence.
`abstract boolean` | `isPossible(int... positions)` This method returns `true` if the given `positions` are in the domain of the PositionDiffSM.
`abstract boolean` | `next()` This method steps to the next reasonable outcome if possible.
`abstract void` | `reset()` This method resets the iterator to the initial state (first reasonable output) so that it can be used again.
`StringBuffer` | `toXML()` This method returns an XML representation as `StringBuffer` of an instance of the implementing class.

Methods inherited from class de.jstacs.sequenceScores.statisticalModels.differentiable.AbstractDifferentiableStatisticalModel
`emitDataSet, getInitialClassParam, getLogProbFor, getLogProbFor, getLogProbFor, getLogScoreFor, getLogScoreFor, getMaximalMarkovOrder, isNormalized, isNormalized`

Methods inherited from class de.jstacs.sequenceScores.differentiable.AbstractDifferentiableSequenceScore
`getAlphabetContainer, getCharacteristics, getLength, getLogScoreAndPartialDerivation, getLogScoreAndPartialDerivation, getLogScoreFor, getLogScoreFor, getNumberOfRecommendedStarts, getNumberOfStarts, getNumericalCharacteristics`

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

Methods inherited from interface de.jstacs.sequenceScores.statisticalModels.differentiable.DifferentiableStatisticalModel
`addGradientOfLogPriorTerm, getESS, getLogNormalizationConstant, getLogPartialNormalizationConstant, getLogPriorTerm, getSizeOfEventSpaceForRandomVariablesOfParameter`

Methods inherited from interface de.jstacs.sequenceScores.differentiable.DifferentiableSequenceScore
`getCurrentParameterValues, getLogScoreAndPartialDerivation, getLogScoreAndPartialDerivation, getNumberOfParameters, getNumberOfRecommendedStarts, initializeFunction, initializeFunctionRandomly, setParameters`

Methods inherited from interface de.jstacs.sequenceScores.SequenceScore
`getAlphabetContainer, getCharacteristics, getInstanceName, getLength, getLogScoreFor, getLogScoreFor, getNumericalCharacteristics, isInitialized`

Field Detail

### internal

    protected int[] internal

  This array is used for some method of `DurationDiffSM` that use an internal memory

  See Also:
    `DurationDiffSM.reset()`, `DurationDiffSM.next()`, `getInternalPosition(int[])`

Constructor Detail

### PositionDiffSM

    protected PositionDiffSM(AlphabetContainer con,
                             int length)

  This constructor allows create instance with more than one dimension. This constructor can be used if the `AlphabetContainer` already exists.

  Parameters:
    `con` - the `AlphabetContainer`
    `length` - the number of dimensions, e.g. the length of the modeled sequences

### PositionDiffSM

    protected PositionDiffSM(int min,
                             int max)

  This is the main constructor that creates the `AlphabetContainer` internally.

  Parameters:
    `min` - the minimal value
    `max` - the maximal value

### PositionDiffSM

    protected PositionDiffSM(StringBuffer source)
                      throws NonParsableException

  This is the constructor for `Storable`. Creates a new `DurationDiffSM` 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 PositionDiffSM clone()
                         throws CloneNotSupportedException

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

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

### reset

    public abstract void reset()

  This method resets the iterator to the initial state (first reasonable output) so that it can be used again.

### next

    public abstract boolean next()

  This method steps to the next reasonable outcome if possible.

  Returns:
    `true` if a next reasonable outcome could be set, otherwise `false`

### getInternalPosition

    public void getInternalPosition(int[] positions)

  Copies the current value of the internal iterator in the given array.

  Parameters:
    `positions` - the array containing the internal positions after calling this method

### getLogScoreForInternal

    public double getLogScoreForInternal()

  This method enables the user to get the log-score without using a sequence object by using the internal iterator.

  Returns:
    the score

### getLogScoreAndPartialDerivationForInternal

    public double getLogScoreAndPartialDerivationForInternal(IntList indices,
                                                             DoubleList partialDer)

  This method enables the user to get the log-score and the partial derivations without using a sequence object by using the internal iterator.

  Parameters:
    `indices` - a list for the indices of the parameters
    `partialDer` - a list of the partial derivations
  Returns:
    the score

### getLogScore

    public abstract double getLogScore(int... values)

  This method enables the user to get the log-score without using a sequence object.

  Parameters:
    `values` - the values
  Returns:
    the score

### getLogScoreAndPartialDerivation

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

  Parameters:
    `indices` - a list for the indices of the parameters
    `partialDer` - a list of the partial derivations
    `values` - the values
  Returns:
    the score

### getLogScoreFor

    public double getLogScoreFor(Sequence seq,
                                 int start)

  Description copied from interface: `SequenceScore`
  Returns the logarithmic score for the `Sequence` `seq` beginning at position `start` in the `Sequence`.

  Parameters:
    `seq` - the `Sequence`
    `start` - the start position in the `Sequence`
  Returns:
    the logarithmic score for the `Sequence`

### getLogScoreAndPartialDerivation

    public double getLogScoreAndPartialDerivation(Sequence seq,
                                                  int start,
                                                  IntList indices,
                                                  DoubleList partialDer)

  Description copied from interface: `DifferentiableSequenceScore`
  Returns the logarithmic score for a `Sequence` beginning at position `start` in the `Sequence` and fills lists with the indices and the partial derivations.

  Parameters:
    `seq` - the `Sequence`
    `start` - the start position in the `Sequence`
    `indices` - an `IntList` of indices, after method invocation the list should contain the indices i where is not zero
    `partialDer` - a `DoubleList` of partial derivations, after method invocation the list should contain the corresponding that are not zero
  Returns:
    the logarithmic score for the `Sequence`

### getValuesFromSequence

    protected int[] getValuesFromSequence(Sequence seq,
                                          int start)

  This method extracts the values form a sequence.

  Parameters:
    `seq` - the sequence
    `start` - the index of the startposition
  Returns:
    the values of the sequence

### isPossible

    public abstract boolean isPossible(int... positions)

  This method returns `true` if the given `positions` are in the domain of the PositionDiffSM.

  Parameters:
    `positions` - the positions to be tested
  Returns:
    `true` if the given `positions` are in the domain of the PositionDiffSM

### toXML

    public StringBuffer toXML()

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

  Returns:
    the XML representation

### fromXML

    protected void fromXML(StringBuffer xml)
                    throws NonParsableException

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

  Specified by:
    `fromXML` in class `AbstractDifferentiableSequenceScore`
  Parameters:
    `xml` - the XML representation as `StringBuffer`
  Throws:
    `NonParsableException` - if the `StringBuffer` could not be parsed
  See Also:
    `AbstractDifferentiableSequenceScore.AbstractDifferentiableSequenceScore(StringBuffer)`

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