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:
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Fast univariate mixture model implementation. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addValue
(double value, double weight) Adds a value to the density estimator.buildModel
(int K, double[] values, double[] weights) Build mixture model.int
Returns the number of components to use.int
Returns the number of Bootstrap runs.int
Returns the number of components to use.String[]
Returns the current set of options.Returns the revision string.int
getSeed()
Gets the seed for the random number generationsboolean
Returns a string describing the estimator.Returns an enumeration that lists the command-line options that are availabledouble
logDensity
(double value) Returns the natural logarithm of the density estimate at the given point.static void
Main method, used for testing this class.The tool tip for this property.The tool tip for this property.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.Returns the tip text for this propertyvoid
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) toString()
Returns textual description of this estimator.
-
Constructor Details
-
UnivariateMixtureEstimator
public UnivariateMixtureEstimator()
-
-
Method Details
-
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
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
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
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
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 interfaceUnivariateDensityEstimator
- Specified by:
addValue
in interfaceUnivariateIntervalEstimator
- Specified by:
addValue
in interfaceUnivariateQuantileEstimator
- Parameters:
value
- the value to addweight
- the weight of the value
-
buildModel
Build mixture model. Assumes K >= 1, values.length >= 1, and values.length = weights.length. -
resampleWithWeights
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 interfaceUnivariateIntervalEstimator
- 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 interfaceUnivariateQuantileEstimator
- 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 interfaceUnivariateDensityEstimator
- Parameters:
value
- the value at which to evaluate- Returns:
- the natural logarithm of the density estimate at the given value
-
toString
Returns textual description of this estimator. -
listOptions
Returns an enumeration that lists the command-line options that are available- Specified by:
listOptions
in interfaceOptionHandler
- Returns:
- the list of options as an enumeration
-
setOptions
Sets options based on the given array of strings.- Specified by:
setOptions
in interfaceOptionHandler
- Parameters:
options
- the list of options to parse- Throws:
Exception
- if an option is not supported
-
getOptions
Returns the current set of options.- Specified by:
getOptions
in interfaceOptionHandler
- Returns:
- the current set of options as a string
-
getRevision
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Returns:
- the revision
-
main
Main method, used for testing this class.- Throws:
Exception
-