-
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
Allow arbitrary learning rule size_in #1310
Conversation
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.
LGTM. This change seems to have really improved the understandability of the code while adding more functionality.
I'd vote for adding a changelog entry because it is not possible to access the |
@jgosmann directed me here from #1311. My problem with this is that the size is now specific to the LearningRuleType object. For example, say the error for my learning rule is always in the size of the I think the best solution is to combine this with #1311. The way I would do this is to make If people are on board with that, I'm happy to implement it. |
I think in the general case it will be necessary to create |
Yeah that's what I was thinking. I'd probably drop |
+1, combining with special strings sounds good, and I'd drop |
Ok, added two commits. The first one does what I proposed. The second allows expressions of these constants, so for example @jgosmann can do |
I don't have a super rigorous argument for this, but I worry that the expressions is getting a bit fancy/fragile/evaly. Having strings that are one-to-one matches with some well-defined behaviour is fairly common, having strings that are evaluated as python expressions less so (outside of |
The thing that concerns me is that errors will be harder to debug. My reason for it is that there are two types of users: developer users (who will be writing new learning rules), and end users (who will be using them). Allowing expressions makes things slightly harder for developer users: They have to be more careful, and errors could be harder to debug. But it makes things easier for the end users, who can then take a learning rule and put it in their network without having to worry about getting the size in correct on each individual connection. To me, that's a worthwhile tradeoff. Thinking about this now, though, to use something like @jgosmann's learning rule users will have to use the sizes of the pre and post objects explicitly anyway, since they'll need to slice into the proper parts of the error signal. So what we really need is learning rules that allow separate error signals, and allowing expressions for the size_in is just a hack that doesn't really fix the problem. |
Ok, let's just go with the simple solution. How does that look? |
Added a fixup commit because |
Sure, looks good. |
I share that concern. I'm pretty sure that in this case, I'd prefer having the user specify |
Never mind -- ignore my above comment. Looks like it got sorted out without me. :) |
I pushed a small fixup that changes the new test to avoid slicing on multiple axes. That works OK in |
I added a changelog entry, but one of the tests are still failing for reasons I don't understand. Any recommendations? |
Maybe we're calling EDIT: I bet it happened when I added the strings to |
I cherry picked the aforementioned commit, the |
Otherwise classes with an __eq__ function could be treated as unequal even though they should be equal.
Also removed unused ConnectionParam.
Added autocomplete (string) values for ``LearningRuleType.size_in``.
Motivation and context:
This is the resolution to #1307, allowing learning rules to be defined with arbitrary
size_in
. Allows for more flexibility in the types of learning rules that can be implemented.Also removes
ConnectionParam
, which wasn't actually being used anywhere.I wasn't sure if we want a changelog entry for this (it's kind of user-facing, but only insofar as users are using the pluggable builder system).
Interactions with other PRs:
Based on discussion in #1307
How has this been tested?
This doesn't actually change anything in the current code base (since we don't have any rules with
size_in
that aren't covered by the previouserror_type
). But I added a test with a custom rule typethat has a non-standard
size_in
.How long should this take to review?
Types of changes:
Checklist: