Package ca.nengo.math

Examples of ca.nengo.math.PDF


    public void testNothing() {
    }

    //functional test ...
    public static void main(String[] args) {
        PDF pdf = new ExponentialPDF(.1f);
        Plotter.plot(pdf, 0, .001f, .5f, "aagg");

        float binSize = .05f;
        float[] bins = new float[8];
        for (int i = 0; i < 10000; i++) {
            float foo = pdf.sample()[0];
            int bin = (int) Math.floor(foo / binSize);
            if (bin <= 7) {
                bins[bin] += 1;
            }
        }
View Full Code Here


  /*
   * Test method for 'ca.nengo.math.impl.IndicatorPDF.sample()'
   */
  public void testSample() {
    PDF pdf = new IndicatorPDF(-1, 1);
   
    for (int i = 0; i < 10; i++) {
      float[] s = pdf.sample();
      assertEquals(1, s.length);
      assertTrue(s[0] > -1 && s[0] < 1);
    }
   
    pdf = new IndicatorPDF(0, 0);
    assertEquals(0f, pdf.sample()[0]);
  }
View Full Code Here

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

  /*
   * Test method for 'ca.nengo.math.impl.IndicatorPDF.map(float[])'
   */
  public void testMap() {
    PDF pdf = new IndicatorPDF(-1, 1);
    assertClose(0f, pdf.map(new float[]{-1.5f}));
    assertClose(.5f, pdf.map(new float[]{-0.5f}));
    assertClose(.5f, pdf.map(new float[]{0.5f}));
    assertClose(0f, pdf.map(new float[]{1.5f}));
   
    pdf = new IndicatorPDF(5, 5);
    assertEquals(Float.POSITIVE_INFINITY, pdf.map(new float[]{5}));
  }
View Full Code Here

  /*
   * Test method for 'ca.nengo.math.impl.IndicatorPDF.multiMap(float[][])'
   */
  public void testMultiMap() {
    PDF pdf = new IndicatorPDF(-1, 1);
    float[] result = pdf.multiMap(new float[][]{new float[]{0f}, new float[]{2f}});
   
    assertEquals(2, result.length);
    assertClose(.5f, result[0]);
    assertClose(0f, result[1]);
  }
View Full Code Here

    };
    ef.setEncoderFactory(new Rectifier(ef.getEncoderFactory(), true));
    ef.setEvalPointFactory(new BiasedVG(new RandomHypersphereVG(false, 0.5f, 0f), 0, excitatoryProjection ? .5f : -.5f));

//    PDF interceptPDF = excitatoryProjection ? new IndicatorPDF(-.5f, .75f) : new IndicatorPDF(-.99f, .35f);
    PDF interceptPDF = excitatoryProjection ? new IndicatorPDF(-.15f, .9f) : new IndicatorPDF(-1.2f, .1f); //was -.5f, .75f for excitatory
    PDF maxRatePDF = excitatoryProjection ? new IndicatorPDF(200f, 500f) : new IndicatorPDF(400f, 800f);
    ef.setNodeFactory(new LIFNeuronFactory(.02f, .0001f, maxRatePDF, interceptPDF));
    ef.setApproximatorFactory(new GradientDescentApproximator.Factory(
        new GradientDescentApproximator.CoefficientsSameSign(true), false));

    NEFEnsemble result = ef.make(name, num, 1);
View Full Code Here

TOP

Related Classes of ca.nengo.math.PDF

Copyright © 2018 www.massapicom. 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.