-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Combined decoders and transform #729
Conversation
Okay, this is ready for review! |
Oh awesome, I ran into that bug recently :) |
Do we have any situations where we learn decoders on PES and then apply a transform? Would that still work? Say if I'm learning a scalar and then projecting that into a higher dimensional space. Or do we now need to apply the same transform to the error signal in this case? |
I think you would need to apply the same transform on the error signal, or at least account for it in some way. |
Previously, we used the type of the pre or post object as a clue to what the learning rule modifies. This makes it more explicit by saying what signal the learning rule actually modifies. This will make it easier to implement learning rules that modify other quantities, like for example `post.encoders`.
45eb473
to
c36e4c1
Compare
Okay, this is rebased and ready for review. The removing 'decoders' from BuiltConnection is optional; we can discuss if we want to do this or not. |
I had been using PES assuming that the error is w.r.t. the decoded vector of dimension I've added a unit test to assert the new behaviour here (and fixed a line to make it pass): 91d59a3 Note: if you change line I'll take a look at the rest soon. |
|
||
|
||
def get_sliced_signal(signal, s, model): | ||
assert signal.ndim == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Rename to
sliced_signal
to be consistent withfiltered_signal
, and sinceget
usually implies no side-effects - Docstring
- Change assertion to exception
Gone over it pretty carefully and it looks good and well thought out. I'm fine with the renaming to |
a016312
to
619f773
Compare
Addressed @arvoelke's suggestions. I kept the asserts in, because I think they should only ever be seen if we mess something up (i.e., users should never see them). I also added a commit to remove the |
Cherry-pick 91d59a3 and update the change log? Then it looks good to me. |
cfe747f
to
0417e5d
Compare
LGTM. Would be good for someone else to look this over now and get it in soon as it's a pretty big change. |
I'll give this a review tonight or early tomorrow! |
OK, reviewed! This looks great to me. Only a few issues, some of which I can do during the merge.
I'll aim to merge this in today. |
My rationale for removing "decoders" from BuiltConnection was that it would be pretty rare for someone to want the decoders without the transform in it. I've started thinking about the "transform" and "function" on connections as going hand in hand (in fact, there's an argument that we shouldn't really even have "transform" on an ensemble->ensemble connection, because you can always build it in to "function", but let's not go there now since it makes problems for other connection types). Anyway, if you want the decoders for the "function" that your connection is computing, I think it makes the most sense if that includes the transform as well, since the transform is also part of the "function" you're computing. As for probing "decoders" and "transform", it's not possible to probe them in the way you could before, which is why I chose "weights" as the name for the new matrix. That way, whether we're talking about BuiltConnection or probing, it's clear that "weights" is different from the old "transform" or "decoders". It would be good to have some error notifying users that "decoders" and "transform" are obsolete, if users try to probe them, but I can't think of any sensible way to map them to what's there now (mapping both "transform" and "decoders" to "weights" would cause problems, I think, because probes would appear to continue working but not return what they used to). |
Rather than storing `decoders` and `transform` separately in the simulated connection, they're now combined into `weights`. This simplifies the connection builder code, as well as the learning rule code. This requires removing 'decoders' from BuiltConnection, as 'weights' has both the 'decoders' and 'transform' combined. I removed it to reduce confusion from 'decoders' returning something different from before. I also added a `SlicedCopy` operator to allow for better post slicing, such as slicing post neurons. Future work includes better pre slicing too. Additionally, connection input slicing was improved. It now works with Neurons, and should make things easier in Nengo OCL. In order to pass tests, I also made the following changes: - Fixed examples to probe 'weights'. - Fixed some of the tests. - Cleaned up the connection builder a bit more and made it work with slices on weight solvers.
Also removed an old Simulator test that tested signal slicing with raw operators, and should be well-covered by other tests.
0417e5d
to
ae03267
Compare
Fixed up history. Squashed the 'removing decoders from BuiltConnection' commit into the main one, as without it most models won't build. Merging in a few minutes unless there are last minute objections! |
I combined
decoders
andtransform
in the connection builder. This makes things a lot cleaner, and it should be easier for users too, since they don't have to decide between probing 'transform' or 'decoders' when doing learning (right now it depends on the type of connection).I also improved slicing, so we support slicing on neuron-to-neuron connections.