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
Class MixtureScoringFunction

    java.lang.Object
      de.jstacs.scoringFunctions.AbstractNormalizableScoringFunction
          de.jstacs.scoringFunctions.mix.AbstractMixtureScoringFunction
              de.jstacs.scoringFunctions.mix.MixtureScoringFunction

All Implemented Interfaces:
  NormalizableScoringFunction, ScoringFunction, Storable, Cloneable

    public class MixtureScoringFunction

extends AbstractMixtureScoringFunction

This class implements a real mixture model.

Author:
  Jens Keilwagen

Field Summary

Fields inherited from class de.jstacs.scoringFunctions.mix.AbstractMixtureScoringFunction
`componentScore, dList, freeParams, function, hiddenParameter, hiddenPotential, iList, isNormalized, logGammaSum, logHiddenNorm, logHiddenPotential, norm, optimizeHidden, paramRef, partNorm`

Fields inherited from class de.jstacs.scoringFunctions.AbstractNormalizableScoringFunction
`alphabets, length, r`

Fields inherited from interface de.jstacs.scoringFunctions.ScoringFunction
`UNKNOWN`

Constructor Summary
`MixtureScoringFunction(int starts, boolean plugIn, NormalizableScoringFunction... component)` This constructor creates a new `MixtureScoringFunction`.
`MixtureScoringFunction(StringBuffer xml)` This is the constructor for the interface `Storable`.

Method Summary
`protected void` | `fillComponentScores(Sequence seq, int start)` Fills the internal array `AbstractMixtureScoringFunction.componentScore` with the logarithmic scores of the components given a `Sequence`.
`double` | `getEss()` Returns the equivalent sample size (ess) of this model, i.e. the equivalent sample size for the class or component that is represented by this model.
`double` | `getHyperparameterForHiddenParameter(int index)` This method returns the hyperparameter for the hidden parameter with index `index`.
`String` | `getInstanceName()` Returns a short instance name.
`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.
`protected double` | `getNormalizationConstantForComponent(int i)` Computes the normalization constant for the component `i`.
`double` | `getPartialNormalizationConstant(int parameterIndex)` Returns the partial normalization constant for the parameter with index `parameterIndex`.
`protected void` | `initializeUsingPlugIn(int index, boolean freeParams, Sample[] data, double[][] weights)` This method initializes the functions using the data in some way.
`String` | `toString()`

Methods inherited from class de.jstacs.scoringFunctions.mix.AbstractMixtureScoringFunction
`addGradientOfLogPriorTerm, clone, cloneFunctions, computeHiddenParameter, computeLogGammaSum, extractFurtherInformation, fromXML, getCurrentParameterValues, getFunction, getFunctions, getFurtherInformation, getIndexOfMaximalComponentFor, getIndices, getLogPriorTerm, getLogScore, getMaxIndex, getNormalizationConstant, getNumberOfComponents, getNumberOfParameters, getNumberOfRecommendedStarts, getProbsForComponent, getScoringFunctions, getSizeOfEventSpaceForRandomVariablesOfParameter, getXMLTag, init, initializeFunction, initializeFunctionRandomly, initializeHiddenPotentialRandomly, initializeHiddenUniformly, initWithLength, isInitialized, isNormalized, precomputeNorm, setHiddenParameters, setParameters, setParametersForFunction, toXML`

Methods inherited from class de.jstacs.scoringFunctions.AbstractNormalizableScoringFunction
`getAlphabetContainer, getInitialClassParam, getLength, getLogScore, getLogScoreAndPartialDerivation, isNormalized`

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

Constructor Detail

### MixtureScoringFunction

    public MixtureScoringFunction(int starts,
                                  boolean plugIn,
                                  NormalizableScoringFunction... component)
                           throws CloneNotSupportedException

  This constructor creates a new `MixtureScoringFunction`.

  Parameters:
    `starts` - the number of starts that should be done in an optimization
    `plugIn` - indicates whether the initial parameters for an optimization should be related to the data or randomly drawn
    `component` - the `ScoringFunction`s
  Throws:
    `CloneNotSupportedException` - if an element of `component` could not be cloned

### MixtureScoringFunction

    public MixtureScoringFunction(StringBuffer xml)
                           throws NonParsableException

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

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

Method Detail

### getNormalizationConstantForComponent

    protected double getNormalizationConstantForComponent(int i)

  Description copied from class: `AbstractMixtureScoringFunction`
  Computes the normalization constant for the component `i`.

  Specified by:
    `getNormalizationConstantForComponent` in class `AbstractMixtureScoringFunction`
  Parameters:
    `i` - the index of the component
  Returns:
    the normalization constant of the component

### getPartialNormalizationConstant

    public double getPartialNormalizationConstant(int parameterIndex)
                                           throws Exception

  Description copied from interface: `NormalizableScoringFunction`
  Returns the partial normalization constant for the parameter with index `parameterIndex`. This is the partial derivation of the normalization constant for the parameter with index `parameterIndex`, in LaTex notation: `\frac{\partial Z(\lambda)}{\partial \lambda_{index}}`.

  Parameters:
    `parameterIndex` - the index of the parameter
  Returns:
    the partial normalization constant
  Throws:
    `Exception` - if something went wrong with the normalization
  See Also:
    `NormalizableScoringFunction.getNormalizationConstant()`

### getHyperparameterForHiddenParameter

    public double getHyperparameterForHiddenParameter(int index)

  Description copied from class: `AbstractMixtureScoringFunction`
  This method returns the hyperparameter for the hidden parameter with index `index`.

  Specified by:
    `getHyperparameterForHiddenParameter` in class `AbstractMixtureScoringFunction`
  Parameters:
    `index` - the index of the hidden parameter
  Returns:
    the hyperparameter for the hidden parameter

### getEss

    public double getEss()

  Description copied from interface: `NormalizableScoringFunction`
  Returns the equivalent sample size (ess) of this model, i.e. the equivalent sample size for the class or component that is represented by this model.

  Returns:
    the equivalent sample size.

### initializeUsingPlugIn

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

  Description copied from class: `AbstractMixtureScoringFunction`
  This method initializes the functions using the data in some way.

  Specified by:
    `initializeUsingPlugIn` in class `AbstractMixtureScoringFunction`
  Parameters:
    `index` - the class index
    `freeParams` - if `true`, the (reduced) parameterization is used``
    `data` - the data
    `weights` - the weights for the data
  Throws:
    `Exception` - if the initialization could not be done
  See Also:
    `ScoringFunction.initializeFunction(int, boolean, Sample[], double[][])`

### getInstanceName

    public String getInstanceName()

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

  Returns:
    a short instance name

### fillComponentScores

    protected void fillComponentScores(Sequence seq,
                                       int start)

  Description copied from class: `AbstractMixtureScoringFunction`
  Fills the internal array `AbstractMixtureScoringFunction.componentScore` with the logarithmic scores of the components given a `Sequence`.

  Specified by:
    `fillComponentScores` in class `AbstractMixtureScoringFunction`
  Parameters:
    `seq` - the sequence
    `start` - the start position in `seq`

### getLogScoreAndPartialDerivation

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

  Description copied from interface: `ScoringFunction`
  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 `\frac{\partial \log score(seq)}{\partial \lambda_i}` is not zero
    `partialDer` - a `DoubleList` of partial derivations, after method invocation the list should contain the corresponding `\frac{\partial \log score(seq)}{\partial \lambda_i}`
  Returns:
    the logarithmic score for the `Sequence`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

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