ctn-waterloo/nengo — pull request #202 by tbekolay (2013-11-13 16:33:36+00:00)
Title: WIP: PES learning rule on decoders

This is a first proof of concept of decoder learning in new Nengo. It just uses the PES rule to learn better decoders, but the way it's implemented is how all the other learning rules will have to be implemented, so I wanted to get feedback on the syntax before I make this work on weights and implement hPES, etc.

First off, here it is learning a communication channel super fast. It starts off with decoders that solve the function f(x) = -1, but does the communication channel after that.
![learning](https://f.cloud.github.com/assets/203709/1533054/0a15269a-4c80-11e3-97f1-60ee0a54648d.png)
Obviously a trivial example, but it's the same math as before so whatev's.

Check out [learn_communicationchannel.py](https://github.com/ctn-waterloo/nengo/blob/0bfc85075657cf990c2ace4e7bd4bc682fbf139b/examples/learn_communicationchannel.py) and see what you think of the syntax. It's just a new kwarg to the connect call (and therefore to the Connection classes).

Things I would appreciate feedback on:

1. Does it make sense to be a kwarg to connect? I'm thinking that the way we pass neuron types to ensembles should be the same way we pass learning rules to connect, but perhaps the semantics of that don't fit as nicely as I think they do.
2. Right now the PES class gets connection information by sneakily storing the connection it's part of. This was just easier, but I can definitely see why this could be confusing. Neurons, for example, don't keep a handle to the ensemble they're part of, and instead have functions that the ensemble calls. Perhaps learning rules should follow this? Or perhaps neuron types should get a handle to its ensemble? This made creating `build_pes` very easy, because `build_connect` doesn't know anything about learning rules. But we have to enforce that learning rules build after all connections. Perhaps the same could happen with neural nonlinearities, which would simplify the `build_ensemble` method?
3. This may only be true of the decoder PES rule, but I think that I could do it using a `DotInc` or something rather than making `SimPES`. Is that true? It might involve reshaping some signals to do it though, is it worth it?