Package ca.nengo.model.nef.impl

Examples of ca.nengo.model.nef.impl.NEFEnsembleFactoryImpl


  protected void setUp() throws Exception {
    super.setUp();
  }

  public void functionalTestAddBiasOrigin() throws StructuralException, SimulationException {
    NEFEnsembleFactory ef = new NEFEnsembleFactoryImpl();

    boolean regenerate = false;
    NEFEnsemble source = ef.make("source", 300, 1, "nefeTest_source", regenerate);
    NEFEnsemble dest = ef.make("dest", 300, 1, "nefeTest_dest", regenerate);
   
    Function f = new AbstractFunction(1) {
      private static final long serialVersionUID = 1L;
      public float map(float[] from) {
        return from[0] - 1;
View Full Code Here


    };
   
    FunctionInput input = new FunctionInput("input", new Function[]{f}, Units.UNK);
    network.addNode(input);
   
    NEFEnsembleFactory ef = new NEFEnsembleFactoryImpl();
    NEFEnsemble pre = ef.make("pre", 400, 1, "nefe_pre", false);
    pre.addDecodedTermination("input", MU.I(1), tauPSC, false);
//    DecodedOrigin baseOrigin = (DecodedOrigin) pre.getOrigin(NEFEnsemble.X);
    network.addNode(pre);
   
    NEFEnsemble post = ef.make("post", 200, 1, "nefe_post", false);
//    DecodedTermination baseTermination = (DecodedTermination) post.addDecodedTermination("pre", MU.I(1), tauPSC, false);
    network.addNode(post);
   
    network.addProjection(input.getOrigin(FunctionInput.ORIGIN_NAME), pre.getTermination("input"));
    Projection projection = network.addProjection(pre.getOrigin(NEFEnsemble.X), post.getTermination("pre"));
View Full Code Here

//   
//    return biasEncoders;
//  }
 
  public void testClone() throws StructuralException, CloneNotSupportedException {
    NEFEnsembleFactory ef = new NEFEnsembleFactoryImpl();
    NEFEnsemble ensemble = ef.make("test", 100, 1);
    long startTime = System.currentTimeMillis();
    ensemble.clone();
    System.out.println(System.currentTimeMillis() - startTime);
  }
View Full Code Here

    }
  }
 
  public void testKillNeurons() throws StructuralException
  {
    NEFEnsembleFactoryImpl ef = new NEFEnsembleFactoryImpl();
    NEFEnsembleImpl nef1 = (NEFEnsembleImpl)ef.make("nef1", 1000, 1);
   
    nef1.killNeurons(0.0f,true);
    int numDead = countDeadNeurons(nef1);
    if(numDead != 0) {
      fail("Number of dead neurons outside expected range");
    }
   
    nef1.killNeurons(0.5f,true);
    numDead = countDeadNeurons(nef1);
    if(numDead < 400 || numDead > 600) {
      fail("Number of dead neurons outside expected range");
    }
   
    nef1.killNeurons(1.0f,true);
    numDead = countDeadNeurons(nef1);
    if(numDead != 1000) {
      fail("Number of dead neurons outside expected range");
    }
   
    NEFEnsembleImpl nef2 = (NEFEnsembleImpl)ef.make("nef2", 1, 1);
    nef2.killNeurons(1.0f,true);
    numDead = countDeadNeurons(nef2);
    if(numDead != 0)
      fail("Relay protection did not work");
    nef2.killNeurons(1.0f,false);
View Full Code Here

    return numDead;
  }
 
  public void testAddDecodedSignalOrigin() throws StructuralException
  {
    NEFEnsembleFactoryImpl ef = new NEFEnsembleFactoryImpl();
    NEFEnsembleImpl ensemble = (NEFEnsembleImpl)ef.make("test", 5, 1);
    float[][] vals = new float[2][1];
    vals[0][0] = 1;
    vals[1][0] = 1;
    TimeSeriesImpl targetSignal = new TimeSeriesImpl(new float[]{0,1}, vals, new Units[]{Units.UNK});
    TimeSeriesImpl[] evalSignals = new TimeSeriesImpl[1];
View Full Code Here

   * @see junit.framework.TestCase#setUp()
   */
  protected void setUp() throws Exception {
    super.setUp();
   
    NEFEnsembleFactoryImpl ef = new NEFEnsembleFactoryImpl();
    NEFEnsemble ensemble = ef.make("test", 100, 1);
    myOrigin = (DecodedOrigin) ensemble.getOrigin(NEFEnsemble.X);
//    Plotter.plot(ensemble, NEFEnsemble.X);
  }
View Full Code Here

    } catch (StructuralException e) {}
  }
 
  public void testKillNeurons() throws StructuralException
  {
    NEFEnsembleFactoryImpl ef = new NEFEnsembleFactoryImpl();
    NEFEnsembleImpl nef1 = (NEFEnsembleImpl)ef.make("nef1", 1000, 1);
    NEFEnsembleImpl nef2 = (NEFEnsembleImpl)ef.make("nef2", 1000, 1);
    NEFEnsembleImpl nef3 = (NEFEnsembleImpl)ef.make("nef3", 1, 1);
    NetworkImpl net = new NetworkImpl();
   
    net.addNode(nef1);
    myNetwork.addNode(net);
    myNetwork.addNode(nef2);
View Full Code Here

     
    NetworkImpl b = new NetworkImpl();
    b.setName("b");
    myNetwork.addNode(b);
   
    NEFEnsembleFactoryImpl ef = new NEFEnsembleFactoryImpl();
    NEFEnsembleImpl c = (NEFEnsembleImpl)ef.make("c", 10, 1);
    b.addNode(c);
    b.getSimulator().addProbe("c", "X", true);
   
    b.exposeOrigin(c.getOrigin("X"), "exposed");
   
View Full Code Here

      fail("Origin not unexposed correctly");
  }
 
  public void testExposeOrigin() throws StructuralException
  {
    NEFEnsembleFactoryImpl ef = new NEFEnsembleFactoryImpl();
    NEFEnsembleImpl a = (NEFEnsembleImpl)ef.make("a", 10, 1);
   
    myNetwork.addNode(a);
   
    myNetwork.exposeOrigin(a.getOrigin("X"), "test");
   
View Full Code Here

    myNetwork.removeNode("a");
  }
 
  public void testHideOrigin() throws StructuralException
  {
    NEFEnsembleFactoryImpl ef = new NEFEnsembleFactoryImpl();
    NEFEnsembleImpl a = (NEFEnsembleImpl)ef.make("a", 10, 1);
   
    myNetwork.addNode(a);
   
    myNetwork.exposeOrigin(a.getOrigin("X"), "test");
   
View Full Code Here

TOP

Related Classes of ca.nengo.model.nef.impl.NEFEnsembleFactoryImpl

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.