nengo / nengo-1.4

Create and run detailed neural simulations
http://www.nengo.ai/nengo-1.4
96 stars 22 forks source link

Specifying a function from a lookup table #386

Open tcstewar opened 11 years ago

tcstewar commented 11 years ago

It'd be great to be able to do this:

input = [[1, 1], [-1, 1], [-1, -1], [1, -1]]
output = [[1], [-1], [1], [-1]]

net.make('A', 200, 2, eval_points=input)
net.make('B', 100, 1)
net.connect('A', 'B', func=output)

This would specify a function from a dataset, rather than defining the function itself. Indeed, we could even load the data in from .csv files

net.make('A', 200, 2, eval_points='input.csv')
net.make('B', 100, 1)
net.connect('A', 'B', func='output.csv')
tcstewar commented 11 years ago

I've implemented the first of the two examples above.

One thing to watch out for is its behaviour if you switch to direct mode: it prints a warning message and then just outputs 0 for the function. I'm not sure what the correct behaviour should be, but one option would be to have it implement a nearest-neighbour algorithm on the lookup table.