Package ca.nengo.model.nef

Examples of ca.nengo.model.nef.NEFEnsembleFactory


//   
//    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


  /**
   * Test method for {@link ca.nengo.model.nef.impl.NEFUtil#getOutput(ca.nengo.model.nef.impl.DecodedOrigin, float[][], ca.nengo.model.SimulationMode)}.
   * @throws StructuralException
   */
  public void testGetOutput() throws StructuralException {
    NEFEnsembleFactory ef = new NEFEnsembleFactoryImpl();
    NEFEnsemble ensemble = ef.make("test", 70, new float[]{1, 1, 1});
    DecodedOrigin origin = (DecodedOrigin) ensemble.addDecodedOrigin("test",
        new Function[]{new PostfixFunction("x1", 3), new PostfixFunction("x2", 3)}, Neuron.AXON);
   
    float[][] input = MU.uniform(500, 3, 1);
    float[][] directOutput = NEFUtil.getOutput(origin, input, SimulationMode.DIRECT);
View Full Code Here

    Function[] functions = new Function[] { fi.parse("x0 < .2", 1),
        new ConstantFunction(1, .5f), new ConstantFunction(1, .2f),
        new ConstantFunction(1, .3f) };
    FunctionInput in = new FunctionInput("input", functions, Units.UNK);

    NEFEnsembleFactory ef = new NEFEnsembleFactoryImpl();

    NEFEnsemble A = ef.make("A", 100, 1, "A", false);
    NEFEnsemble B = ef.make("B", 100, 1, "B", false);
    NEFEnsemble C = ef.make("C", 100, 1, "C", false);
    NEFEnsemble D = ef.make("D", 100, 1, "D", false);

    NEFEnsemble rule1a = ef.make("rule1a", 500, 2, "rule1a", false);
    NEFEnsemble rule1b = ef.make("rule1b", 500, 2, "rule1b", false);
    NEFEnsemble rule2 = ef.make("rule2", 200, 1, "rule2", false);
    rule2.collectSpikes(true);

    rule1a.addDecodedOrigin("OR", new Function[] { new MAX(2) },
        Neuron.AXON);
    rule1b.addDecodedOrigin("AND", new Function[] { new MIN(2) },
        Neuron.AXON);
    rule1a.doneOrigins();
    rule1b.doneOrigins();
    rule2.doneOrigins();

    NEFEnsemble output = ef.make("output", 500, 5, "fuzzyoutput", false);

    net.addNode(in);
    net.addNode(A);
    net.addNode(B);
    net.addNode(C);
View Full Code Here

    Function f = new ConstantFunction(1, 1f);
    FunctionInput input = new FunctionInput("input", new Function[] { f }, Units.UNK);

    // uiViewer.addNeoNode(uiInput);

    NEFEnsembleFactory ef = new NEFEnsembleFactoryImpl();
    NEFEnsemble integrator = ef.make("integrator", 500, 1, "integrator1", false);
    Termination interm = integrator.addDecodedTermination("input",
        new float[][] { new float[] { tau } }, tau, false);
    Termination fbterm = integrator.addDecodedTermination("feedback",
        new float[][] { new float[] { 1f } }, tau, false);
View Full Code Here

    FunctionInput input = new FunctionInput("input", new Function[] { f },
        Units.UNK);

    // uiViewer.addNeoNode(uiInput);

    NEFEnsembleFactory ef = new NEFEnsembleFactoryImpl();
    NEFEnsemble integrator = ef.make("integrator", 500, 1, "integrator1",
        false);
    Termination interm = integrator.addDecodedTermination("input",
        new float[][] { new float[] { tau } }, tau, false);
    Termination fbterm = integrator.addDecodedTermination("feedback",
        new float[][] { new float[] { 1f } }, tau, false);
View Full Code Here

    Function f = new ConstantFunction(1, 1f);
    // Function f = new SineFunction();
    FunctionInput input = new FunctionInput("input", new Function[] { f }, Units.UNK);
    network.addNode(input);

    NEFEnsembleFactory ef = new NEFEnsembleFactoryImpl();

    NEFEnsemble integrator = ef.make("integrator", 500, 1, "integrator1", false);
    network.addNode(integrator);
    integrator.collectSpikes(true);

    // Plotter.plot(integrator);
    // Plotter.plot(integrator, NEFEnsemble.X);
View Full Code Here

          return 1 + from[0];
        }
      };
    }

    NEFEnsembleFactory ef = new NEFEnsembleFactoryImpl() {
      private static final long serialVersionUID = 1L;
      protected void addDefaultOrigins(NEFEnsemble ensemble) {} //wait until some neurons are adjusted
    };
    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);

    //TODO: bounding neurons for inhibitory projection
    //set intercepts of first few neurons to 1 (outside normal range)
    int n = 10;
    for (int i = 0; i < n; i++) {
View Full Code Here

TOP

Related Classes of ca.nengo.model.nef.NEFEnsembleFactory

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.