Package org.apache.mahout.math.jet.random

Large variety of probability distributions featuring high performance generation of random numbers, CDF's and PDF's.

See:
          Description

Class Summary
AbstractContinousDistribution Abstract base class for all continuous distributions.
AbstractDiscreteDistribution Abstract base class for all discrete distributions.
AbstractDistribution  
Beta Deprecated. until unit tests are in place.
Binomial Deprecated. until unit tests are in place.
BreitWigner Deprecated. until unit tests are in place.
BreitWignerMeanSquare Deprecated. until unit tests are in place.
ChiSquare Deprecated. until unit tests are in place.
Distributions Deprecated. until unit tests are in place.
Empirical Deprecated. until unit tests are in place.
EmpiricalWalker Deprecated. until unit tests are in place.
Exponential  
ExponentialPower Deprecated. until unit tests are in place.
Fun Contains various mathematical helper methods.
Gamma  
Hyperbolic Deprecated. until unit tests are in place.
HyperGeometric Deprecated. until unit tests are in place.
Logarithmic Deprecated. until unit tests are in place.
NegativeBinomial Mostly deprecated until unit tests are in place.
Normal Implements a normal distribution specified mean and standard deviation.
Poisson Partially deprecated until unit tests are in place.
PoissonSlow Deprecated. until unit tests are in place.
StudentT Deprecated. until unit tests are in place.
Uniform  
VonMises Deprecated. until unit tests are in place.
Zeta Deprecated. until unit tests are in place.
 

Package org.apache.mahout.math.jet.random Description

Large variety of probability distributions featuring high performance generation of random numbers, CDF's and PDF's. You can always do a quick and dirty check to test the properties of any given distribution, for example, as follows:

// Gamma distribution

// define distribution parameters
double mean = 5;
double variance = 1.5;
double alpha = mean*mean / variance; 
double lambda = 1 / (variance / mean); 

// for tests and debugging use a random engine with CONSTANT seed --> deterministic and reproducible results
org.apache.mahout.math.jet.random.engine.RandomEngine engine = new engine.MersenneTwister();

// your favourite distribution goes here
org.apache.mahout.math.jet.random.AbstractDistribution dist = new Gamma(alpha,lambda,engine);

// collect random numbers and print statistics
int size = 100000;
org.apache.mahout.math.list.DoubleArrayList numbers = new DoubleArrayList(size);
for (int i=0; i < size; i++) numbers.add(dist.nextDouble());

hep.aida.bin.DynamicBin1D bin = new hep.aida.bin.DynamicBin1D();
bin.addAllOf(numbers);
log.info(bin);

Will print something like

Size: 100000
Sum: 499830.30147620925
SumOfSquares: 2648064.0189520954
Min: 1.2903021480010035
Max: 12.632626684290546
Mean: 4.998303014762093
RMS: 5.14593433591228
Variance: 1.497622138362513
Standard deviation: 1.2237737284165373
Standard error: 0.0038699123224725817
Geometric mean: 4.849381516061957
Product: Infinity
Harmonic mean: 4.69916104903662
Sum of inversions: 21280.394299425236
Skew: 0.49097523334186227
Kurtosis: 0.3461005384481113
Sum of powers(3): 1.4822908764628284E7
Sum of powers(4): 8.741360251658581E7
Sum of powers(5): 5.41658186456702E8
Sum of powers(6): 3.5183920126086535E9
Moment(0,0): 1.0
Moment(1,0): 4.998303014762093
Moment(2,0): 26.480640189520955
Moment(3,0): 148.22908764628284
Moment(4,0): 874.1360251658581
Moment(5,0): 5416.58186456702
Moment(6,0): 35183.92012608654
Moment(0,mean()): 1.0
Moment(1,mean()): 3.7017002796346785E-14
Moment(2,mean()): 1.4976071621409774
Moment(3,mean()): 0.8998351672510565
Moment(4,mean()): 7.50487543880015
Moment(5,mean()): 14.413483695698101
Moment(6,mean()): 77.72119325586715
25%, 50%, 75% Quantiles: 4.122365795016783, 4.897730017566362, 5.763097174551738
quantileInverse(median): 0.500005
Distinct elements & frequencies not printed (too many).



Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.