Package com.facebook.LinkBench.distributions

Examples of com.facebook.LinkBench.distributions.ProbabilityDistribution.pdf()


  public void testPDFSanity() {
    ProbabilityDistribution dist = getDist();
    long min = 453, max = 26546454;
    dist.init(min, max, getDistParams(), "");

    assertEquals(0.0, dist.pdf(min-1));
    assertEquals(0.0, dist.pdf(min-234321));
    assertEquals(0.0, dist.pdf(max));
    assertEquals(0.0, dist.pdf(max+2343242224234L));

    // Check pdf is in correct range
View Full Code Here


    ProbabilityDistribution dist = getDist();
    long min = 453, max = 26546454;
    dist.init(min, max, getDistParams(), "");

    assertEquals(0.0, dist.pdf(min-1));
    assertEquals(0.0, dist.pdf(min-234321));
    assertEquals(0.0, dist.pdf(max));
    assertEquals(0.0, dist.pdf(max+2343242224234L));

    // Check pdf is in correct range
    double total = 0.0;
View Full Code Here

    long min = 453, max = 26546454;
    dist.init(min, max, getDistParams(), "");

    assertEquals(0.0, dist.pdf(min-1));
    assertEquals(0.0, dist.pdf(min-234321));
    assertEquals(0.0, dist.pdf(max));
    assertEquals(0.0, dist.pdf(max+2343242224234L));

    // Check pdf is in correct range
    double total = 0.0;
    long step = (max - min) / pdfChecks();
View Full Code Here

    dist.init(min, max, getDistParams(), "");

    assertEquals(0.0, dist.pdf(min-1));
    assertEquals(0.0, dist.pdf(min-234321));
    assertEquals(0.0, dist.pdf(max));
    assertEquals(0.0, dist.pdf(max+2343242224234L));

    // Check pdf is in correct range
    double total = 0.0;
    long step = (max - min) / pdfChecks();
    for (long id = min; id < max; id += step) {
View Full Code Here

    // Check pdf is in correct range
    double total = 0.0;
    long step = (max - min) / pdfChecks();
    for (long id = min; id < max; id += step) {
      double p = dist.pdf(id);
      if ((id - min) < step * 100) {
        System.err.println("p(X=" + id + ") = " + p);
      }
      assertTrue(p >= 0.0);
      assertTrue(p <= 1.0);
View Full Code Here

    // Check sum of pdf over small range
    // Order of least to most probably to minimize sum error
    double total = 0.0;
    for (long id = max - 1; id >= min; id--) {
      double p = dist.pdf(id);
      assertTrue(p >= 0.0);
      assertTrue(p <= 1.0);
      System.err.println("p(X=" + id + ") = " + p);
      total += p;
    }
View Full Code Here

    long step = (max - min) / cdfChecks();
    for (long id = min + 1; id < max; id += step) {
      double c = dist.cdf(id);
      double c1 = dist.cdf(id - 1);
      double p = dist.pdf(id);

      double err = Math.abs((c - c1) - p);
      if (err > 0.0001) {
        fail(String.format("Error > 0.001: cdf(%d) - cdf(%d) = %f, pdf(%d) = %f",
                              id, id -1, c1 - c, id, p));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.