Package ca.nengo.math.impl

Examples of ca.nengo.math.impl.PoissonPDF.sample()


  private static void doTestSample(float rate) {
    PoissonPDF pdf = new PoissonPDF(rate);
    int n = 1000;
    int[] bins = new int[100];
    for (int i = 0; i < n; i++) {
      int sample = (int) Math.round(pdf.sample()[0]);
      if (sample < bins.length) bins[sample]++;
    }
    for (int i = 0; i < bins.length; i++) {
      TestUtil.assertClose(pdf.map(new float[]{i}), (float) bins[i]/ (float) n, .05f);
    }
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.