weka.classifiers.meta.generators
Class MixedGaussianGenerator

java.lang.Object
  extended by weka.classifiers.meta.generators.Generator
      extended by weka.classifiers.meta.generators.RandomizableGenerator
          extended by weka.classifiers.meta.generators.RandomizableDistributionGenerator
              extended by weka.classifiers.meta.generators.MixedGaussianGenerator
All Implemented Interfaces:
java.io.Serializable, Mean, NumericAttributeGenerator, OptionHandler

public class MixedGaussianGenerator
extends RandomizableDistributionGenerator
implements NumericAttributeGenerator

A mixed Gaussian artificial data generator.

This generator only has two Gaussians, each sitting 3 standard deviations (by default) away from the mean of the main distribution. Each model has half of the probability. The idea is that the two sub-models form a boundary either side of the main distribution.

Valid options are:

 -D
  If set, generator is run in debug mode and
  may output additional info to the console
 -S <seed>
  Sets the seed of the random number generator of the generator (default: 1)
 -M <num>
  Sets the mean of the generator
  (default: 0)
 -SD <num>
  Sets the standard deviation of the generator
  (default: 1)
 -di <distance>
  Sets the difference between the mean and what will be used
  on the lower and higher distributions for the generator. (default: 3)
 -da
  If set, the generator will use the absolute value of the
  difference. If not set, it will multiply the difference by
  the standard deviation.

Version:
$Revision: 5793 $
Author:
Kathryn Hempstalk (kah18 at cs.waikato.ac.nz)
See Also:
Serialized Form

Constructor Summary
MixedGaussianGenerator()
           
 
Method Summary
 java.lang.String distanceAbsoluteTipText()
          Returns the tip text for this property.
 java.lang.String distanceTipText()
          Returns the tip text for this property.
 double generate()
          Generates a value that falls under this distribution.
 double getDistance()
          Gets the difference between the main distribution and each of the models.
 boolean getDistanceAbsolute()
          Gets whether the difference will be an absolute value, or something that is used as a multiplier to the standard deviation.
 double getLogProbabilityOf(double valuex)
          Gets the (natural) log of the probability of a given value.
 java.lang.String[] getOptions()
          Gets the current settings of the generator.
 double getProbability(double valuex, double mean, double stddev)
          Gets the probability that a value falls under a given Gaussian distribution.
 double getProbabilityOf(double valuex)
          Gets the probability that a value falls under this distribution.
 java.lang.String globalInfo()
          Returns a string describing this class' ability.
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options.
 void setDistance(double diff)
          Sets the difference between the main distribution and the models.
 void setDistanceAbsolute(boolean newdiff)
          Sets the difference to be absolute (or not).
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 
Methods inherited from class weka.classifiers.meta.generators.RandomizableDistributionGenerator
getMean, getStandardDeviation, meanTipText, setMean, setStandardDeviation, standardDeviationTipText
 
Methods inherited from class weka.classifiers.meta.generators.RandomizableGenerator
getSeed, seedTipText, setSeed
 
Methods inherited from class weka.classifiers.meta.generators.Generator
copy, debugTipText, forName, getDebug, setDebug
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MixedGaussianGenerator

public MixedGaussianGenerator()
Method Detail

globalInfo

public java.lang.String globalInfo()
Returns a string describing this class' ability.

Specified by:
globalInfo in class Generator
Returns:
A description of the class.

listOptions

public java.util.Enumeration listOptions()
Returns an enumeration describing the available options.

Specified by:
listOptions in interface OptionHandler
Overrides:
listOptions in class RandomizableDistributionGenerator
Returns:
an enumeration of all the available options.

setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Parses a given list of options.

Valid options are:

 -D
  If set, generator is run in debug mode and
  may output additional info to the console
 -S <seed>
  Sets the seed of the random number generator of the generator (default: 1)
 -M <num>
  Sets the mean of the generator
  (default: 0)
 -SD <num>
  Sets the standard deviation of the generator
  (default: 1)
 -di <distance>
  Sets the difference between the mean and what will be used
  on the lower and higher distributions for the generator. (default: 3)
 -da
  If set, the generator will use the absolute value of the
  difference. If not set, it will multiply the difference by
  the standard deviation.

Specified by:
setOptions in interface OptionHandler
Overrides:
setOptions in class RandomizableDistributionGenerator
Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported

getOptions

public java.lang.String[] getOptions()
Gets the current settings of the generator.

Specified by:
getOptions in interface OptionHandler
Overrides:
getOptions in class RandomizableDistributionGenerator
Returns:
an array of strings suitable for passing to setOptions

getDistance

public double getDistance()
Gets the difference between the main distribution and each of the models. The default difference is 3, and will cause each model to be 3 standard deviations away from the mean. One model is created either side of the mean.

Returns:
The difference between the main distribution and a model.

setDistance

public void setDistance(double diff)
Sets the difference between the main distribution and the models. See getDistance() for a longer explanation.

Parameters:
diff - The new difference.

distanceTipText

public java.lang.String distanceTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

getDistanceAbsolute

public boolean getDistanceAbsolute()
Gets whether the difference will be an absolute value, or something that is used as a multiplier to the standard deviation.

Returns:
Whether the difference will be absolute or not.

setDistanceAbsolute

public void setDistanceAbsolute(boolean newdiff)
Sets the difference to be absolute (or not).

Parameters:
newdiff - Whether the difference should be absolute or a standard deviation modifier.

distanceAbsoluteTipText

public java.lang.String distanceAbsoluteTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

generate

public double generate()
Generates a value that falls under this distribution.

Specified by:
generate in class Generator
Returns:
A generated value.

getProbabilityOf

public double getProbabilityOf(double valuex)
Gets the probability that a value falls under this distribution.

Specified by:
getProbabilityOf in class Generator
Parameters:
valuex - The value to get the probability of.
Returns:
The probability of the given value.

getProbability

public double getProbability(double valuex,
                             double mean,
                             double stddev)
Gets the probability that a value falls under a given Gaussian distribution.

Parameters:
valuex - The value to get the probability of.
mean - The mean of the Gaussian distribution.
stddev - The standard deviation of the Gaussian distribution.
Returns:
The probability of the given value.

getLogProbabilityOf

public double getLogProbabilityOf(double valuex)
Gets the (natural) log of the probability of a given value.

Specified by:
getLogProbabilityOf in class Generator
Parameters:
valuex - The value to get the log probability of.
Returns:
The (natural) log of the probability.