org.apache.mahout.math.random
Class Empirical
java.lang.Object
org.apache.mahout.math.function.DoubleFunction
org.apache.mahout.math.random.AbstractSamplerFunction
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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.
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.