Skip to content
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

Warn if gain, bias override intercepts, max_rates #1433

Merged
merged 1 commit into from
Apr 24, 2018

Conversation

pblouw
Copy link
Contributor

@pblouw pblouw commented Apr 24, 2018

Motivation and context:

See issue #1431. This PR adds a warning that occurs whenever an ensemble is built for which specified gains and biases override specified intercepts and/or max_rates. I'm happy to get feedback regarding, for example, whether it makes sense to either issue a warning elsewhere, or add something to the documentation that explains how gains, biases, max_rates, and intercepts are related, and then count on the user not to create ensembles of the sort under consideration here.

Interactions with other PRs:

None so far as I know.

How has this been tested?

I've added a test that checks whether a UserWarning is issued whenever an ensemble is built for which gains, biases and at least one of max_rates and intercepts are specified.

How long should this take to review?

  • Quick (less than 40 lines changed or changes are straightforward)

Where should a reviewer start?

The get_gain_bias function in nengo/builder/ensemble.py has the core change, so it's likely best to start there before moving on to looking at the corresponding test.

Types of changes:

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have read the CONTRIBUTING.rst document.
  • I have updated the documentation accordingly.
  • I have included a changelog entry.
  • I have added tests to cover my changes.
  • I have run the test suite locally and all tests passed.

There's no docstring for the get_gain_bias function, and it is likely not something that a user would ever call directly, so I haven't added any documentation. It also seems like a small enough change to avoid including a changelog entry, but I'm happy add this if it makes sense to.

Still to do:

Nothing at this point.

warnings.warn(
"Specifying the gains and biases for %s imposes a set of "
"maximum firing rates and intercepts. Further specifying "
"either max_rates or intercepts has no effect." % ens)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make this a NengoWarning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When initially thinking about this, I stuck with a UserWarning for consistency with the warning issued by gen_eval_points. In any event, I've added a fixup to use a NengoWarning, but it doesn't seem like there is a widespread usage of these throughout the codebase (i.e. most warnings are UserWarnings based on a quick search). Is there a rule of thumb for when one should preferred over the other? Or should most of the existing UserWarnings be switched over to NengoWarnings? (I'm happy to do this at some point if that is the case)

Copy link
Contributor

@Seanny123 Seanny123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch Jan.

@tbekolay tbekolay merged commit eb9cafc into master Apr 24, 2018
@tbekolay tbekolay deleted the ensemble_build_warning branch April 24, 2018 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants