Package weka.estimators

# Class UnivariateMixtureEstimator

java.lang.Object
weka.estimators.UnivariateMixtureEstimator

All Implemented Interfaces:
  `Serializable`, `OptionHandler`, `RevisionHandler`, `UnivariateDensityEstimator`, `UnivariateIntervalEstimator`, `UnivariateQuantileEstimator`

public class UnivariateMixtureEstimator extends Object implements UnivariateDensityEstimator, UnivariateIntervalEstimator, UnivariateQuantileEstimator, OptionHandler, Serializable
Simple weighted mixture density estimator. Uses a mixture of Gaussians and applies the leave-one-out bootstrap for model selection. Can alternatively use normalized entropy.

Version:
  $Revision: 8034 $
Author:
  Eibe Frank (eibe@cs.waikato.ac.nz)
See Also:
  - Serialized Form

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `class`
  `UnivariateMixtureEstimator.MM`
  Fast univariate mixture model implementation.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UnivariateMixtureEstimator()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addValue(double value, double weight)`
  Adds a value to the density estimator.
  `UnivariateMixtureEstimator.MM`
  `buildModel(int K, double[] values, double[] weights)`
  Build mixture model.
  `int`
  `getMaxNumComponents()`
  Returns the number of components to use.
  `int`
  `getNumBootstrapRuns()`
  Returns the number of Bootstrap runs.
  `int`
  `getNumComponents()`
  Returns the number of components to use.
  `String[]`
  `getOptions()`
  Returns the current set of options.
  `String`
  `getRevision()`
  Returns the revision string.
  `int`
  `getSeed()`
  Gets the seed for the random number generations
  `boolean`
  `getUseNormalizedEntropy()`
  `String`
  `globalInfo()`
  Returns a string describing the estimator.
  `Enumeration<Option>`
  `listOptions()`
  Returns an enumeration that lists the command-line options that are available
  `double`
  `logDensity(double value)`
  Returns the natural logarithm of the density estimate at the given point.
  `static void`
  `main(String[] args)`
  Main method, used for testing this class.
  `String`
  `maxNumComponentsToolTipText()`
  The tool tip for this property.
  `String`
  `numBootstrapRunsToolTipText()`
  The tool tip for this property.
  `String`
  `numComponentsToolTipText()`
  The tool tip for this property.
  `double[][]`
  `predictIntervals(double conf)`
  Returns the interval for the given confidence value.
  `double`
  `predictQuantile(double percentage)`
  Returns the quantile for the given percentage.
  `double[][]`
  `resampleWithWeights(Random random, boolean[] sampled)`
  Creates a new dataset of the same size using random sampling with replacement according to the given weight vector.
  `String`
  `seedTipText()`
  Returns the tip text for this property
  `void`
  `setMaxNumComponents(int maxNumComponents)`
  Sets the number of components to use.
  `void`
  `setNumBootstrapRuns(int numBootstrapRuns)`
  Sets the number of Bootstrap runs.
  `void`
  `setNumComponents(int numComponents)`
  Sets the number of components to use.
  `void`
  `setOptions(String[] options)`
  Sets options based on the given array of strings.
  `void`
  `setSeed(int seed)`
  Set the seed for random number generation.
  `void`
  `setUseNormalizedEntropy(boolean useNormalizedEntropy)`
  `String`
  `toString()`
  Returns textual description of this estimator.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### UnivariateMixtureEstimator

    public UnivariateMixtureEstimator()

- ## Method Details

  - ### globalInfo

    public String globalInfo()
    Returns a string describing the estimator.

  - ### getUseNormalizedEntropy

    public boolean getUseNormalizedEntropy()
    Returns:
      whether normalized entropy is used

  - ### setUseNormalizedEntropy

    public void setUseNormalizedEntropy(boolean useNormalizedEntropy)
    Parameters:
      `useNormalizedEntropy` - whether to use normalized entropy

  - ### numBootstrapRunsToolTipText

    public String numBootstrapRunsToolTipText()
    The tool tip for this property.

  - ### getNumBootstrapRuns

    public int getNumBootstrapRuns()
    Returns the number of Bootstrap runs.
    Returns:
      the number of Bootstrap runs

  - ### setNumBootstrapRuns

    public void setNumBootstrapRuns(int numBootstrapRuns)
    Sets the number of Bootstrap runs.
    Parameters:
      `mnumBootstrapRuns` - the number of Bootstrap runs

  - ### numComponentsToolTipText

    public String numComponentsToolTipText()
    The tool tip for this property.

  - ### getNumComponents

    public int getNumComponents()
    Returns the number of components to use.
    Returns:
      the m_NumComponents

  - ### setNumComponents

    public void setNumComponents(int numComponents)
    Sets the number of components to use.
    Parameters:
      `m_NumComponents` - the m_NumComponents to set

  - ### seedTipText

    public String seedTipText()
    Returns the tip text for this property
    Returns:
      tip text for this property suitable for displaying in the explorer/experimenter gui

  - ### setSeed

    public void setSeed(int seed)
    Set the seed for random number generation.
    Parameters:
      `seed` - the seed

  - ### getSeed

    public int getSeed()
    Gets the seed for the random number generations
    Returns:
      the seed for the random number generation

  - ### maxNumComponentsToolTipText

    public String maxNumComponentsToolTipText()
    The tool tip for this property.

  - ### getMaxNumComponents

    public int getMaxNumComponents()
    Returns the number of components to use.
    Returns:
      the maximum number of components to use

  - ### setMaxNumComponents

    public void setMaxNumComponents(int maxNumComponents)
    Sets the number of components to use.
    Parameters:
      `maxNumComponents` - the maximum number of components to evaluate

  - ### addValue

    public void addValue(double value, double weight)
    Adds a value to the density estimator.
    Specified by:
      `addValue` in interface `UnivariateDensityEstimator`
    Specified by:
      `addValue` in interface `UnivariateIntervalEstimator`
    Specified by:
      `addValue` in interface `UnivariateQuantileEstimator`
    Parameters:
      `value` - the value to add
      `weight` - the weight of the value

  - ### buildModel

    public UnivariateMixtureEstimator.MM buildModel(int K, double[] values, double[] weights)
    Build mixture model. Assumes K >= 1, values.length >= 1, and values.length = weights.length.

  - ### resampleWithWeights

    public double[][] resampleWithWeights(Random random, boolean[] sampled)
    Creates a new dataset of the same size using random sampling with replacement according to the given weight vector. The weights of the instances in the new dataset are set to one.

  - ### predictIntervals

    public double[][] predictIntervals(double conf)
    Returns the interval for the given confidence value.
    Specified by:
      `predictIntervals` in interface `UnivariateIntervalEstimator`
    Parameters:
      `conf` - the confidence value in the interval [0, 1]
    Returns:
      the interval

  - ### predictQuantile

    public double predictQuantile(double percentage)
    Returns the quantile for the given percentage.
    Specified by:
      `predictQuantile` in interface `UnivariateQuantileEstimator`
    Parameters:
      `percentage` - the percentage
    Returns:
      the quantile

  - ### logDensity

    public double logDensity(double value)
    Returns the natural logarithm of the density estimate at the given point.
    Specified by:
      `logDensity` in interface `UnivariateDensityEstimator`
    Parameters:
      `value` - the value at which to evaluate
    Returns:
      the natural logarithm of the density estimate at the given value

  - ### toString

    public String toString()
    Returns textual description of this estimator.
    Overrides:
      `toString` in class `Object`

  - ### listOptions

    public Enumeration<Option> listOptions()
    Returns an enumeration that lists the command-line options that are available
    Specified by:
      `listOptions` in interface `OptionHandler`
    Returns:
      the list of options as an enumeration

  - ### setOptions

    public void setOptions(String[] options) throws Exception
    Sets options based on the given array of strings.
    Specified by:
      `setOptions` in interface `OptionHandler`
    Parameters:
      `options` - the list of options to parse
    Throws:
      `Exception` - if an option is not supported

  - ### getOptions

    public String[] getOptions()
    Returns the current set of options.
    Specified by:
      `getOptions` in interface `OptionHandler`
    Returns:
      the current set of options as a string

  - ### getRevision

    public String getRevision()
    Returns the revision string.
    Specified by:
      `getRevision` in interface `RevisionHandler`
    Returns:
      the revision

  - ### main

    public static void main(String[] args) throws Exception
    Main method, used for testing this class.
    Throws:
      `Exception`