Example usage for org.apache.mahout.math.jet.random AbstractContinousDistribution cdf

List of usage examples for org.apache.mahout.math.jet.random AbstractContinousDistribution cdf

Introduction

In this page you can find the example usage for org.apache.mahout.math.jet.random AbstractContinousDistribution cdf.

Prototype

public double cdf(double x) 

Source Link

Usage

From source file:com.mapr.stats.DistributionTest.java

License:Apache License

protected void checkDistribution(AbstractContinousDistribution d, String test, double epsilon) {
    // pull a bunch of samples
    int n = 40001;
    double[] s = new double[n];
    for (int i = 0; i < n; i++) {
        s[i] = d.nextDouble();/*from www .  ja v a 2  s  . c o  m*/
    }

    // sort
    Arrays.sort(s);

    // and compare all 5 quartiles to see if things look about right
    for (int q = 0; q <= 4; q++) {
        assertEquals(test + ", q = " + q, d.cdf(s[(n - 1) * q / 4]), q / 4.0, epsilon);
    }
}

From source file:com.mapr.stats.DistributionTest.java

License:Apache License

protected void cdfCheck(double[] expected, double[] cdf, AbstractContinousDistribution d) {
    // check against precomputed cdf values
    for (int i = 0; i < expected.length; i++) {
        assertEquals(expected[i], d.cdf(cdf[i]), 1e-10);
    }/*  w  w w  .j  a va 2 s .  co  m*/
}