org.apache.mahout.clustering
Class UncommonDistributions

java.lang.Object
  extended by org.apache.mahout.clustering.UncommonDistributions

public final class UncommonDistributions
extends Object


Method Summary
static double rBeta(double shape1, double shape2)
          Returns a random sample from a beta distribution with the given shapes
static int rBinomial(int n, double p)
          Returns an integer sampled according to this distribution.
static double rGamma(double k, double lambda)
          Returns a double sampled according to this distribution.
static double rNorm(double mean, double sd)
          Return a random value from a normal distribution with the given mean and standard deviation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

rGamma

public static double rGamma(double k,
                            double lambda)
Returns a double sampled according to this distribution. Uniformly fast for all k > 0. (Reference: Non-Uniform Random Variate Generation, Devroye http://cgm.cs.mcgill.ca/~luc/rnbookindex.html) Uses Cheng's rejection algorithm (GB) for k>=1, rejection from Weibull distribution for 0 < k < 1.


rBeta

public static double rBeta(double shape1,
                           double shape2)
Returns a random sample from a beta distribution with the given shapes

Parameters:
shape1 - a double representing shape1
shape2 - a double representing shape2
Returns:
a Vector of samples

rNorm

public static double rNorm(double mean,
                           double sd)
Return a random value from a normal distribution with the given mean and standard deviation

Parameters:
mean - a double mean value
sd - a double standard deviation
Returns:
a double sample

rBinomial

public static int rBinomial(int n,
                            double p)
Returns an integer sampled according to this distribution. Takes time proportional to np + 1. (Reference: Non-Uniform Random Variate Generation, Devroye http://cgm.cs.mcgill.ca/~luc/rnbookindex.html) Second time-waiting algorithm.



Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.