Package ca.nengo.model.nef.impl

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


    NetworkImpl net = new NetworkImpl();
   
    if(net.getNodeTerminations().size() != 0)
      fail("Network has terminations when it shouldn't");
   
    NEFEnsembleFactoryImpl ef = new NEFEnsembleFactoryImpl();
    NEFEnsembleImpl a = (NEFEnsembleImpl)ef.make("a", 10, 1);
    float[][] tmp = new float[1][1];
    tmp[0][0] = 1;
    a.addDecodedTermination("in", tmp, 0.007f, false);
   
    net.addNode(a);
View Full Code Here


    NetworkImpl net = new NetworkImpl();
   
    if(net.getNodeOrigins().size() != 0)
      fail("Network has origins when it shouldn't");
   
    NEFEnsembleFactoryImpl ef = new NEFEnsembleFactoryImpl();
    NEFEnsembleImpl a = (NEFEnsembleImpl)ef.make("a", 10, 1);
   
    net.addNode(a);
   
    if(net.getNodeOrigins().size() != a.getOrigins().length)
      fail("Network hasn't found node origin");
View Full Code Here

 
  public void testReset() throws StructuralException, SimulationException
  {
    NetworkImpl net = new NetworkImpl();
   
    NEFEnsembleFactoryImpl ef = new NEFEnsembleFactoryImpl();
    NEFEnsembleImpl a = (NEFEnsembleImpl)ef.make("a", 10, 1);
    a.addDecodedTermination("input", new float[][]{new float[]{1}}, 0.01f, false);
   
    net.addNode(a);
   
    FunctionInput fin = new FunctionInput("fin", new Function[]{new ConstantFunction(1,0)}, Units.UNK);
View Full Code Here

     
      NetworkImpl test1 = new NetworkImpl();
      test1.setName("test1");
      top.addNode(test1);
     
      NEFEnsembleFactoryImpl fac = new NEFEnsembleFactoryImpl();
      NEFEnsembleImpl testens = (NEFEnsembleImpl)fac.make("test", 100, 1);
      testens.addDecodedTermination("input", new float[][]{new float[]{1}}, 0.01f, false);
      test1.addNode(testens);
     
      test1.exposeTermination(testens.getTermination("input"), "in");
     
View Full Code Here

     *
     * @throws StructuralException
     */
    private void createDendrites() throws StructuralException {
        NEFEnsemble[] e = new NEFEnsemble[this.size];
        NEFEnsembleFactoryImpl f = new NEFEnsembleFactoryImpl();
        NodeFactory g = null;
        int i = 0;
        float[][] w = MU.I(this.dim); //Identity Matrix transform for the termination on each dendritic ensemble
        Random rand = new Random(); //random number generator to select scales for dendrite trees
        Random sizeRand = new Random();//Random number generator to select subunit numbers

        int newR; //new range from which to choose dendrite scales from
        int newSize; //new size chosen from subUnitRange

        if (this.LIFDendrites == true) {
            g = new LIFNeuronFactory();
        } else {
            //According to Poirazi et al (2003), a pyramidal neuron's dendrites can be represented as sigmoid subunits capable of spiking
            //The function of the sigmoid subunits is assumed to be the same for each subunit and is...
            //... s(n) = 1/(1+exp((3.6-n)/0.20) + 0.30n + 0.0114n^2)
            g = new PoiraziDendriteFactory();
        }

        f.setNodeFactory(g);

        //make ensemble and add termination
        while (i < this.size) {

            //if the high and low values are the same, then there is no need to randomly pick a number
            if (this.mySubDifference == 0) {
                newSize = (int)this.myDendriteCount.getLow();

                //if a range is given, a new size is chosen for each dendritic ensemble between the two values specified
            } else {
                //while this can be done in the class IndicatorPDF, it returns a float[] and is incompatible with the make function of NEFEnsembleFactoryImpl
                newSize = (int) (this.myDendriteCount.getLow() + sizeRand.nextInt((int)(this.mySubDifference + 1)));
            }

            if (this.LIFDendrites == false) {

                //select a new range of dendrite scales
                //the range is selected at random from the ranges value. This represents the range of scales for the dendritic tree as a whole
                //then, each dendrite gets a random scale number chosen from this new range
                newR = rand.nextInt(this.ranges);

                //ensures that the range to choose from is always greater than 0 in order to avoid an exception
                if(newR == 0) {
                    newR = 1;
                }

                this.myRange[i][0] = newR;
                ((PoiraziDendriteFactory)g).changeRange(newR);
            }

            e[i] = f.make("Dendrites" + i, newSize, this.dim);
            e[i].addDecodedTermination("dinput" + i, w , 0.007f, false);

            //if a function is being computed, the radius and encoders are different than they normally would be
            if (this.myConnectedOrigin != "X") {
                ((NEFEnsembleImpl)e[i]).setEncoders(this.setDendriteEncoders(newSize));
View Full Code Here

     * @throws StructuralException
     */
    private void createTransferEnsemble() throws StructuralException
    {
        NEFEnsemble e;
        NEFEnsembleFactoryImpl f = new NEFEnsembleFactoryImpl();
        NodeFactory g = new LIFNeuronFactory();
        int i = 0;
        int currentDim = 0;
        float[][][] w = new float[this.dim][this.dim][1];
        f.setNodeFactory(g);

        e = f.make("Transfer", 1, this.dim);

        //when terminations at the network level are multidimensional, a single multidimensional termination is needed at the level of ...
        //... the tranfer ensemble. Otherwise, single dimensional terminations are needed, each storing their value in a different...
        //...dimension of the transfer ensemble
        if(this.oneDimTerminations == true)
View Full Code Here

     *there are as many nodes in this ensemble as there are "nonlinear neurons" in the network
     */
    private void createSoma() throws StructuralException
    {
        NEFEnsemble e;
        NEFEnsembleFactoryImpl f = new NEFEnsembleFactoryImpl();
        NodeFactory g;

        //Originally a sigmoid function was given for the soma in the Poirazi et al. article as well.
        //This was not used due to the fact that it characterizes a rate response as opposed to spiking behaviour
        //Instead, a spiking LIFNeuron is used, until a spiking function can be found for pyramidal neurons
        //creates a standard node factory
        g = new LIFNeuronFactory();
        ((LIFNeuronFactory)g).setIntercept(new IndicatorPDF(-1,1));
        ((LIFNeuronFactory)g).setTauRC(0.02f);
        ((LIFNeuronFactory)g).setTauRef(0.002f);
        ((LIFNeuronFactory)g).setMaxRate(new IndicatorPDF(100,200));

        //if X is the origin the dendrites connect to the soma with, then this network is treated as a communication channel
        //thus the soma is given the same dimensions as the dendritic ensembles
        if (this.myConnectedOrigin.equals("X"))
        {
            this.somaDim = this.dim;
        }

        f.setNodeFactory(g);
        e = f.make("Soma", this.size, this.somaDim);
        this.soma = e;


        this.somaEncoders = this.soma.getEncoders();

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

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.