Purpose: This demo shows how to construct a network that adds two inputs.

Comments: Essentially, this is two communication channels into the same population. Addition is thus somewhat ‘free’, since the incoming currents from different synaptic connections interact linearly (though two inputs don’t have to combine in this way: see the combining demo).

Usage: Grab the slider controls and move them up and down to see the effects of increasing or decreasing input. The C population represents the sum of A and B representations. Note that the ‘addition’ is a description of neural firing in the decoded space. Neurons don’t just add all the incoming spikes (the NEF has determined appropriate connection weights to make the result in C interpretable (i.e., decodable) as the sum of A and B).

Output: See the screen capture below

import nef

net=nef.Network('Addition') #Create the network object

net.make_input('input A',[0])  #Create a controllable input function 
                               #with a starting value of 0
net.make_input('input B',[0])  #Create another controllable input 
                               #function with a starting value of 0
net.make('A',100,1) #Make a population with 100 neurons, 1 dimension
net.make('B',100,1)  #Make a population with 100 neurons, 1 dimension
net.make('C',100,1) #Make a population with 100 neurons, 1 dimension

net.connect('input A','A') #Connect all the relevant objects
net.connect('input B','B')

Nengo User Manual

Table Of Contents

This Page