org.apache.mahout.math.random
Class Empirical

java.lang.Object
  extended by org.apache.mahout.math.function.DoubleFunction
      extended by org.apache.mahout.math.random.AbstractSamplerFunction
          extended by org.apache.mahout.math.random.Empirical
All Implemented Interfaces:
Sampler<Double>

public final class Empirical
extends AbstractSamplerFunction

Samples from an empirical cumulative distribution.


Constructor Summary
Empirical(boolean exceedMinimum, boolean exceedMaximum, int samples, double... ecdf)
          Sets up a sampler for a specified empirical cumulative distribution function.
 
Method Summary
 Double sample()
           
 double sample(double u)
           
 
Methods inherited from class org.apache.mahout.math.random.AbstractSamplerFunction
apply
 
Methods inherited from class org.apache.mahout.math.function.DoubleFunction
isDensifying
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Empirical

public Empirical(boolean exceedMinimum,
                 boolean exceedMaximum,
                 int samples,
                 double... ecdf)
Sets up a sampler for a specified empirical cumulative distribution function. The distribution can have optional exponential tails on either or both ends, but otherwise does a linear interpolation between known points.

Parameters:
exceedMinimum - Should we generate samples less than the smallest quantile (i.e. generate a left tail)?
exceedMaximum - Should we generate samples greater than the largest observed quantile (i.e. generate a right tail)?
samples - The number of samples observed to get the quantiles.
ecdf - Alternating values that represent which percentile (in the [0..1] range) and values. For instance, if you have the min, median and max of 1, 3, 10 you should pass 0.0, 1, 0.5, 3, 1.0, 10. Note that the list must include the 0-th (1.0-th) quantile if the left (right) tail is not allowed.
Method Detail

sample

public Double sample()
Specified by:
sample in interface Sampler<Double>
Specified by:
sample in class AbstractSamplerFunction

sample

public double sample(double u)


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