Examples of GaussianPDF


Examples of ca.nengo.math.impl.GaussianPDF

   * Test method for 'ca.nengo.math.impl.GaussianPDF.sample()'
   */
  public void testSample() {
    int n = 1000;
   
    GaussianPDF pdf = new GaussianPDF(0f, 1f);
    assertEquals(1, pdf.sample().length);
   
    int c = 0;
    for (int i = 0; i < n; i++) {
      float sample = pdf.sample()[0];
      if (sample > -1f && sample < 1f) c++;
    }
    ourLogger.info("GaussianPDFTest c: " + c);
    assertTrue(c > 620 && c < 740); //should be about 682 but will vary randomly

    pdf = new GaussianPDF(-10f, 4f);
    assertEquals(1, pdf.sample().length);
   
    c = 0;
    for (int i = 0; i < n; i++) {
      float sample = pdf.sample()[0];
      if (sample > -12f && sample < -8f) c++;
    }
    ourLogger.info("GaussianPDFTest c: " + c);
    assertTrue(c > 620 && c < 740);
  }
View Full Code Here

Examples of ca.nengo.math.impl.GaussianPDF

  /*
   * Test method for 'ca.nengo.math.impl.GaussianPDF.getDimension()'
   */
  public void testGetDimension() {
    GaussianPDF pdf = new GaussianPDF(0f, 1f);
    assertEquals(1, pdf.getDimension());
  }
View Full Code Here

Examples of ca.nengo.math.impl.GaussianPDF

   * Test method for 'ca.nengo.math.impl.GaussianPDF.map(float[])'
   */
  public void testMap() {
    float tolerance = .0001f;

    GaussianPDF pdf = new GaussianPDF(0f, 1f);   
    TestUtil.assertClose(0.1109f, pdf.map(new float[]{-1.6f}), tolerance);
    TestUtil.assertClose(0.3989f, pdf.map(new float[]{0f}), tolerance);
    TestUtil.assertClose(0.3910f, pdf.map(new float[]{.2f}), tolerance);

    pdf = new GaussianPDF(1f, 2f);   
    TestUtil.assertClose(0.0521f, pdf.map(new float[]{-1.6f}), tolerance);
    TestUtil.assertClose(0.2197f, pdf.map(new float[]{0f}), tolerance);
    TestUtil.assertClose(0.2404f, pdf.map(new float[]{.2f}), tolerance);
  }
View Full Code Here

Examples of ca.nengo.math.impl.GaussianPDF

      //... and plot the probed data from the simulation ...
      //Plotter.plot(p.getData(), "function output");
     
      //now here are a couple of function bases ...
      Function g1 = new GaussianPDF(0, 1);
      Function g2 = new GaussianPDF(0.5f, 1);     
      FunctionBasis gaussianBasis = new FunctionBasisImpl(new Function[]{g1, g2});
     
      //here is a plot of the probed vector X the gaussian basis (value at time 4.5s) ...      
      gaussianBasis.setCoefficients(p.getData().getValues()[4500]);
      //Plotter.plot(gaussianBasis, -3, .001f, 3, "gaussian basis plot");
View Full Code Here

Examples of ca.nengo.math.impl.GaussianPDF

   * Test of optional peak constructor argument
   */
  public void testScale() {
    float tolerance = .002f;

    GaussianPDF pdf = new GaussianPDF(1f, 2f, 10f);
    float scale = 35.4491f; //based on unscaled peak of .2821
    TestUtil.assertClose(scale*0.0521f, pdf.map(new float[]{-1.6f}), tolerance);
    TestUtil.assertClose(scale*0.2197f, pdf.map(new float[]{0f}), tolerance);
    TestUtil.assertClose(scale*0.2404f, pdf.map(new float[]{.2f}), tolerance);
   
//    Plotter.plot(pdf, -3, .001f, 3, "foo");
//    try { Thread.sleep(1000*10); } catch (InterruptedException e) {}
  }
View Full Code Here

Examples of ca.nengo.math.impl.GaussianPDF

  /*
   * Test method for 'ca.nengo.math.impl.GaussianPDF.multiMap(float[][])'
   */
  public void testMultiMap() {
    GaussianPDF pdf = new GaussianPDF(0f, 1f);
    float[] from1 = new float[]{-.5f};   
    float val1 = pdf.map(from1);
    float[] from2 = new float[]{-.3f};   
    float val2 = pdf.map(from2);
   
    float[] vals = pdf.multiMap(new float[][]{from1, from2});
    TestUtil.assertClose(val1, vals[0], .0001f);
    TestUtil.assertClose(val2, vals[1], .0001f);
  }
View Full Code Here

Examples of ca.nengo.math.impl.GaussianPDF

    TestUtil.assertClose(val1, vals[0], .0001f);
    TestUtil.assertClose(val2, vals[1], .0001f);
  }
 
  public static void main(String[] args) {
    GaussianPDF pdf = new GaussianPDF(1f, 2f);
    Plotter.plot(pdf, -2, .01f, 2, "Gaussian");
  }
View Full Code Here

Examples of ca.nengo.math.impl.GaussianPDF

    public static void main(String[] args) {
        float tau = .01f;
        DynamicalSystem dynamics = new SimpleLTISystem(new float[]{-1f/tau}, new float[][]{new float[]{1f/tau}}, MU.I(1), new float[1], new Units[]{Units.UNK});
        Integrator integrator = new EulerIntegrator(.0001f);
//      Noise noise = NoiseFactory.makeRandomNoise(1000, new GaussianPDF(0, 1));
        Noise noise = NoiseFactory.makeRandomNoise(1000, new GaussianPDF(0, 1), dynamics, integrator);
//      Noise noise = NoiseFactory.makeNullNoise(1);
//      Noise noise = NoiseFactory.makeExplicitNoise(new Function[]{new FourierFunction(1, 10, 1, -1)});

        float elapsedTime = .001f;
        int steps = 1000;
View Full Code Here

Examples of ca.nengo.math.impl.GaussianPDF

    /**
     * @param dim Number of outputs of the DecodedOrigin
     */
    public AdditiveGaussianExpressModel(int dim) {
        myDim = dim;
        myPDF = new GaussianPDF();
        reset(false);
    }
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.