weka.estimators

## Class UnivariateMixtureEstimator

- java.lang.Object
- - weka.estimators.UnivariateMixtureEstimator

- All Implemented Interfaces:
    java.io.Serializable, OptionHandler, RevisionHandler, UnivariateDensityEstimator, UnivariateIntervalEstimator, UnivariateQuantileEstimator

      public class UnivariateMixtureEstimator
      extends java.lang.Object
      implements UnivariateDensityEstimator, UnivariateIntervalEstimator, UnivariateQuantileEstimator, OptionHandler, java.io.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 and Description
    --- | ---
    `class` | `UnivariateMixtureEstimator.MM` Fast univariate mixture model implementation.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UnivariateMixtureEstimator()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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.
    `java.lang.String[]` | `getOptions()` Returns the current set of options.
    `java.lang.String` | `getRevision()` Returns the revision string.
    `int` | `getSeed()` Gets the seed for the random number generations
    `boolean` | `getUseNormalizedEntropy()`
    `java.lang.String` | `globalInfo()` Returns a string describing the estimator.
    `java.util.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(java.lang.String[] args)` Main method, used for testing this class.
    `java.lang.String` | `maxNumComponentsToolTipText()` The tool tip for this property.
    `java.lang.String` | `numBootstrapRunsToolTipText()` The tool tip for this property.
    `java.lang.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(java.util.Random random, boolean[] sampled)` Creates a new dataset of the same size using random sampling with replacement according to the given weight vector.
    `java.lang.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(java.lang.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)`
    `java.lang.String` | `toString()` Returns textual description of this estimator.

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

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

- - ### Constructor Detail

    - #### UnivariateMixtureEstimator

          public UnivariateMixtureEstimator()

  - ### Method Detail

    - #### globalInfo

          public java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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(java.util.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 java.lang.String toString()

      Returns textual description of this estimator.
      Overrides:
        `toString` in class `java.lang.Object`

    - #### listOptions

          public java.util.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(java.lang.String[] options)
                          throws java.lang.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:
        `java.lang.Exception` - if an option is not supported

    - #### getOptions

          public java.lang.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 java.lang.String getRevision()

      Returns the revision string.
      Specified by:
        `getRevision` in interface `RevisionHandler`
      Returns:
        the revision

    - #### main

          public static void main(java.lang.String[] args)
                           throws java.lang.Exception

      Main method, used for testing this class.
      Throws:
        `java.lang.Exception`