de.lmu.ifi.dbs.elki.data.synthetic.bymodel.distribution
Class NormalDistribution

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.data.synthetic.bymodel.distribution.NormalDistribution
All Implemented Interfaces:
Distribution

public final class NormalDistribution
extends Object
implements Distribution

Simple generator for a Gaussian = Normal Distribution


Field Summary
private  double mean
          Mean value for the generator
private  Random random
          The random generator.
private  double stddev
          Standard deviation
 
Constructor Summary
NormalDistribution(double mean, double stddev, Random random)
          Constructor for Gaussian generator
 
Method Summary
 double explain(double val)
          Return the PDF of the generators distribution
 double generate()
          Generate a random value with the generators parameters
 double getMean()
           
 double getStddev()
           
private static double phi(double x)
          Standardized Gaussian PDF
static double phi(double x, double mu, double sigma)
          Gaussian distribution PDF
 String toString()
          Simple toString explaining the distribution parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mean

private double mean
Mean value for the generator


stddev

private double stddev
Standard deviation


random

private Random random
The random generator.

Constructor Detail

NormalDistribution

public NormalDistribution(double mean,
                          double stddev,
                          Random random)
Constructor for Gaussian generator

Parameters:
mean - Mean
stddev - Standard Deviation
random - Random generator
Method Detail

phi

private static double phi(double x)
Standardized Gaussian PDF

Parameters:
x - query value
Returns:
probability density

phi

public static double phi(double x,
                         double mu,
                         double sigma)
Gaussian distribution PDF

Parameters:
x - query value
mu - mean
sigma - standard distribution
Returns:
probability density

explain

public double explain(double val)
Return the PDF of the generators distribution

Specified by:
explain in interface Distribution
Parameters:
val - existing value
Returns:
distribution density

generate

public double generate()
Generate a random value with the generators parameters

Specified by:
generate in interface Distribution
Returns:
new generated value

toString

public String toString()
Simple toString explaining the distribution parameters. Used in producing a model description.

Specified by:
toString in interface Distribution
Overrides:
toString in class Object
Returns:
description

getMean

public double getMean()
Returns:
the mean

getStddev

public double getStddev()
Returns:
the standard deviation

Release 0.4.0 (2011-09-20_1324)