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, function, hiddenParameter, hiddenPotential, iList, isNormalized, logGammaSum, logHiddenNorm, logHiddenPotential, norm, optimizeHidden, paramRef, partNorm, plugIn`

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 mixture.
`MixtureScoringFunction(StringBuffer xml)` This is the constructor for `Storable`.

Method Summary
`protected void` | `fillComponentScores(Sequence seq, int start)` Fills the internal array `componentScore` with the log scores of the components.
`double` | `getEss()` Returns the equivalent sample size 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 log score for the sequence and fills the list 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 function 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 mixture.

  Parameters:
    `starts` - the number of starts the should be done in an optimization
    `plugIn` - whether the initial parameters for an optimization should be related to the data or randomly drawn
    `component` - the ScoringFunctions
  Throws:
    `CloneNotSupportedException`

### MixtureScoringFunction

    public MixtureScoringFunction(StringBuffer xml)
                           throws NonParsableException

  This is the constructor for `Storable`.

  Parameters:
    `xml` - the xml representation
  Throws:
    `NonParsableException` - if the 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

### 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` `\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

### 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
  Returns:
    the hyperparameter

### getEss

    public double getEss()

  Description copied from interface: `NormalizableScoringFunction`
  Returns the equivalent sample size 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 function 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
  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 `componentScore` with the log scores of the components.

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

### getLogScoreAndPartialDerivation

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

  Description copied from interface: `ScoringFunction`
  Returns the log score for the sequence and fills the list with the indices and the partial derivations.

  Parameters:
    `seq` - the sequence
    `start` - the startposition in the sequence
    `indices` - after method invocation the list should contain the indices i where \frac{\partial \log score(seq)}{\partial \lambda_i} is not zero
    `partialDer` - after method invocation the list should contain the corresponding \frac{\partial \log score(seq)}{\partial \lambda_i}
  Returns:
    the log score

### 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