-
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
Raise exception on invalid gains. #1248
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, except for the error messages which I have a tendency of being too picky with.
@@ -95,6 +96,14 @@ def get_gain_bias(ens, rng=np.random): | |||
max_rates = get_samples(ens.max_rates, ens.n_neurons, rng=rng) | |||
intercepts = get_samples(ens.intercepts, ens.n_neurons, rng=rng) | |||
gain, bias = ens.neuron_type.gain_bias(max_rates, intercepts) | |||
if gain is not None and ( | |||
not np.all(np.isfinite(gain)) or np.any(gain <= 0.)): | |||
raise BuildError( |
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.
Would it be useful to link to a discussion of this problem? Maybe a forum post with the delightful doodles you made?
Can we get this PR merged soon? |
cbbefa3
to
0c441a1
Compare
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.
Amended in some changelog entries. Will merge when CI finishes, unless someone has issues with the changelog.
This also requires fixing the calculation of gains and biases for sigmoid neurons. Because the intercepts for sigmoid neurons are actually not an intercept, but the inflection point, valid intercepts depend on whether the max firing rate is below or above the inflection point. This commit also adjusts the default refractory time constant of the sigmoid neurons to play well with intercepts < 1 and max firing rates between 200 and 400Hz. This required some slight adjustments to tests. Fixes #1212.
0c441a1
to
ffbb174
Compare
Motivation and context:
As noted in #1212 (and #1231) intercepts >= 1 give unexpected results for most neuron types. The matter is however a bit more complicated as detailed in this comment. The correct generalization to all neuron types (in my opinion) is that non-positive gains give unexpected results. Thus, the core change of this PR is to check this and raise an exception when violated. There is a bunch of related changes, though:
tau_ref
to 0.0025 which brings the inflection point to 200Hz and the firing rate in the limit to 400Hz. This at least allows to use the sigmoid neuron type without an exception and changing any of the other ensemble defaults. But technically it is a breaking change! We could leavetau_ref
at it's old value, but would likely need to adjust the max_rates in a lot of our tests.tau_ref
changed the sigmoid tuning curves which required to fix a few other tests.Interactions with other PRs:
This PR supersedes #1243.
How has this been tested?
Added some tests for the sigmoid neuron and a test checking that invalid intercepts raise an exception.
How long should this take to review?
Types of changes:
tau_ref
change: Bug fix (non-breaking change which fixes an issue)]Checklist: