Search in sources :

Example 1 with GeometricDistribution

use of org.apache.commons.math3.distribution.GeometricDistribution in project presto by prestodb.

the class TestTDigestFunctions method testGeometricDistribution.

@Test(enabled = false)
public void testGeometricDistribution() {
    int trials = 10;
    for (int k = 1; k < trials; k++) {
        TDigest tDigest = createTDigest(STANDARD_COMPRESSION_FACTOR);
        GeometricDistribution geometric = new GeometricDistribution(k * 0.1);
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < NUMBER_OF_ENTRIES; i++) {
            int sample = geometric.sample();
            tDigest.add(sample);
            list.add(sample);
        }
        Collections.sort(list);
        for (int i = 0; i < quantiles.length; i++) {
            assertDiscreteQuantileWithinBound(quantiles[i], STANDARD_ERROR, list, tDigest);
        }
    }
}
Also used : TDigest(com.facebook.presto.tdigest.TDigest) TDigest.createTDigest(com.facebook.presto.tdigest.TDigest.createTDigest) ArrayList(java.util.ArrayList) GeometricDistribution(org.apache.commons.math3.distribution.GeometricDistribution) Test(org.testng.annotations.Test)

Example 2 with GeometricDistribution

use of org.apache.commons.math3.distribution.GeometricDistribution in project presto by prestodb.

the class TestTDigest method testGeometricDistribution.

@Test(enabled = false)
public void testGeometricDistribution() {
    int trials = 10;
    for (int k = 1; k < trials; k++) {
        TDigest tDigest = createTDigest(STANDARD_COMPRESSION_FACTOR);
        GeometricDistribution geometric = new GeometricDistribution(k * 0.1);
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < NUMBER_OF_ENTRIES; i++) {
            int sample = geometric.sample();
            tDigest.add(sample);
            list.add(sample);
        }
        assertSumInts(list, tDigest);
        Collections.sort(list);
        for (int i = 0; i < quantile.length; i++) {
            assertDiscreteWithinBound(quantile[i], STANDARD_ERROR, list, tDigest);
        }
    }
}
Also used : TDigest.createTDigest(com.facebook.presto.tdigest.TDigest.createTDigest) ArrayList(java.util.ArrayList) GeometricDistribution(org.apache.commons.math3.distribution.GeometricDistribution) Test(org.testng.annotations.Test)

Aggregations

TDigest.createTDigest (com.facebook.presto.tdigest.TDigest.createTDigest)2 ArrayList (java.util.ArrayList)2 GeometricDistribution (org.apache.commons.math3.distribution.GeometricDistribution)2 Test (org.testng.annotations.Test)2 TDigest (com.facebook.presto.tdigest.TDigest)1