Package ca.nengo.math.impl

Examples of ca.nengo.math.impl.SigmoidFunction


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


  /*
   * Test method for 'ca.nengo.math.impl.SigmoidFunction.map(float[])'
   */
  public void testMap() {
    SigmoidFunction f = new SigmoidFunction();
    TestUtil.assertClose(0.5f, f.map(new float[]{0}), .00001f);
    TestUtil.assertClose(1f, f.map(new float[]{100}), .00001f);
    TestUtil.assertClose(0.952574f, f.map(new float[]{3}), .00001f);
    f = new SigmoidFunction(0f,1f,2f,3f);
    TestUtil.assertClose(2f, f.map(new float[]{-100}), .00001f);
    TestUtil.assertClose(2.5f, f.map(new float[]{0}), .00001f);
    TestUtil.assertClose(2.960834f, f.map(new float[]{.8f}), .00001f);
  }
View Full Code Here

  /*
   * Test method for 'ca.nengo.math.impl.SigmoidFunction.multiMap(float[][])'
   */
  public void testMultiMap() {
    SigmoidFunction f = new SigmoidFunction();

    float[] values = f.multiMap(new float[][]{new float[]{3}, new float[]{-2}});
    TestUtil.assertClose(0.952574f, values[0], .00001f);
    TestUtil.assertClose(0.1192029f, values[1], .00001f);
  }
View Full Code Here

 
  /*
   *   Test method for 'ca.nengo.math.impl.SigmoidFunction.getDerivative()'
   */
  public void testGetDerivative() {
    SigmoidFunction f = new SigmoidFunction(-1f,0.5f,1f,2f);
    AbstractFunction g = (AbstractFunction)f.getDerivative();
   
    assertEquals(1, g.getDimension());
    TestUtil.assertClose(0.209987f, g.map(new float[]{0f}), .00001f);
    TestUtil.assertClose(0.5f, g.map(new float[]{-1f}), .00001f);
    TestUtil.assertClose(0.000670475f, g.map(new float[]{3f}), .00001f);
View Full Code Here

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

  /*
   * Test method for 'ca.nengo.math.impl.NumericallyDifferentiableFunction.map(float[])'
   */
  public void testMap() {
    SigmoidFunction f = new SigmoidFunction();
    NumericallyDifferentiableFunction wrap = new NumericallyDifferentiableFunction(f, 0, 0.1f);
   
    assertEquals(wrap.map(new float[]{0}), f.map(new float[]{0}));
    assertEquals(wrap.map(new float[]{3}), f.map(new float[]{3}));
    assertEquals(wrap.map(new float[]{100}), f.map(new float[]{100}));
  }
View Full Code Here

  /*
   * Test method for 'ca.nengo.math.impl.NumericallyDifferentiableFunction.multiMap(float[][])'
   */
  public void testMultiMap() {
    SigmoidFunction f = new SigmoidFunction();
    NumericallyDifferentiableFunction wrap = new NumericallyDifferentiableFunction(f, 0, 0.1f);

    float[] values = f.multiMap(new float[][]{new float[]{3}, new float[]{-2}});
    float[] newVals = wrap.multiMap(new float[][]{new float[]{3}, new float[]{-2}});
    assertEquals(values[0],newVals[0]);
    assertEquals(values[1],newVals[1]);
  }
View Full Code Here

 
  /*
   *   Test method for 'ca.nengo.math.impl.NumericallyDifferentiableFunction.getDerivative()'
   */
  public void testGetDerivative() {
    SigmoidFunction f = new SigmoidFunction(-1f,0.5f,1f,2f);
    Function g = f.getDerivative();
    NumericallyDifferentiableFunction wrap = new NumericallyDifferentiableFunction(f, 0, 0.01f);
    Function gWrap = wrap.getDerivative();
   
    assertEquals(gWrap.getDimension(), g.getDimension());
    TestUtil.assertClose(gWrap.map(new float[]{0f}), g.map(new float[]{0f}), .0001f);
View Full Code Here

    }

    //functional test
    public static void main(String[] args) {
        Function current = new FourierFunction(1f, 5f, 1f, (long) Math.random());
        Function rate = new SigmoidFunction(0, 5, 0, 40);
        PoissonSpikeGenerator generator = new PoissonSpikeGenerator(rate);

        float T = 1;
        float dt = .0005f;
        int steps = (int) Math.floor(T/dt);
View Full Code Here

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

TOP

Related Classes of ca.nengo.math.impl.SigmoidFunction

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.