This blog is for notes on how to use the Nengo spiking neuron modeling system

Friday, June 24, 2011

convolution

Convolution is a way of combining vectors into a single vector that represents the combination. There is a funciton for this in nengo. Here is an example. If you run it not that it combines the vectors dog and cat but not mouse. The result is a vector that highlights dog and cat but not mouse

import nef
import hrr
vocab=hrr.Vocabulary(128)
vocab.parse('cat,dog,mouse')

net=nef.Network('Test Network',quick=True)

input1=net.make_input('input1',values=vocab.parse('cat').v)
input2=net.make_input('input2',values=vocab.parse('dog').v)

A=net.make_array('A',neurons=30,dimensions=1,length=128) # array is less costly to make than a large ensemble
B=net.make_array('B',neurons=30,dimensions=1,length=128) # creates a more localist representation
C=net.make_array('C',neurons=30,dimensions=1,length=128) # will not norm the data as well


# convolve A and B together into C - function only works on pairs
Conv=nef.convolution.make_convolution(net,'conv',A,B,C,N_per_D=200,quick=True) # neurons per dimension N_per_D


net.add_to(world)

No comments:

Post a Comment