def buildModel(ind): # model model = nef.Network('model') # input inputs = model.add(routing.twoDimsRouter('inputs')); # TODO: general IO dimensions # output output = inFactory.makeLifNeuron(mr, 'spike', model, name='output',intercept=0); #output = inFactory.makeLinearNeuron(mr, 'spike', model, name='output',intercept=0); #output = inFactory.makeSigmoidNeuron(mr, 'spike', model, name='output', inflection=0.4); CI = spiketofloat.controlledIntegrator(model,0); outputt = model.add(routing.getFirstDim('outputt')); # TODO: general IO dimensions model.connect(output,CI,transform=[1,0],pstc=0.1) model.connect(CI,outputt.getTermination('in')) ##model.connect(inputs.getOrigin('out'), output, index_pre=1) # spiking ANN model.make('ANN', neurons=N, dimensions=INdim, mode='spike', encoders = ([1,0], [0,1]), intercept= (ii, ii), max_rate = (mr,mr)) # wire it: model.connect('ANN','ANN',weight_func=setReccurent); # recurrent conencitons model.connect('ANN','output',weight_func=setOutW); # ANN to output # for each input, make one neuron and connect it for d in range(INdim): # choose factory for input neurons: #inFactory.makeLinearNeuron(mr,d,model,'spike'); #inFactory.makeBioLinearNeuron(mr,d,model,'spike'); #inFactory.makeSigmoidNeuron(mr, 'spike', model, num=d); inFactory.makeLifNeuron(mr, 'spike', model, num=d,intercept=0); #inFactory.makeBioSigmoidNeuron(mr,d,model,'spike'); # connect shared input to input neuron and neuron to ANN with weights actualIn=d; model.connect(inputs.getOrigin('out'), 'in_neuron_%d'%d, index_pre=d) model.connect('in_neuron_%d'%d, 'ANN',weight_func=setInW) return model;
def buildModel(ind): # model model = nef.Network('model') # input inputs = model.add(routing.twoDimsRouter('inputs')); # TODO: general IO dimensions # output # output = model.make('output', neurons=OUTdim, dimensions=OUTdim, mode='spike', # max_rate= (mr,mr), intercept=(ii,ii),encoders=[[1],[1]],decoder_sign=+1); output = inFactory.makeLifNeuron(50, 'spike', model, name='output',intercept=0); #output = inFactory.makeSigmoidNeuron(mr, 'spike', model, name='output'); CI = buildcontrolledIntegrator(model); outputt = model.add(routing.getFirstDim('outputt')); # TODO: general IO dimensions model.connect(output,CI,transform=[2,0],pstc=0.1) model.connect(CI,outputt.getTermination('in')) model.connect(inputs.getOrigin('out'), output, index_pre=1) return model;