-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Pass a string to NDArray(name=...) and raise NotImplemented on named models in SMC #4365
Conversation
Nice, thanks @basnijholt ! Is it possible to add a little test somewhere, or to change an existing test so that this is checked? |
Codecov Report
@@ Coverage Diff @@
## master #4365 +/- ##
==========================================
- Coverage 88.00% 87.95% -0.05%
==========================================
Files 88 88
Lines 14342 14493 +151
==========================================
+ Hits 12622 12748 +126
- Misses 1720 1745 +25
|
@MarcoGorelli, there is no public API that exposes this directly (AFAIK). OTOH, these types of errors are easily caught by adding type hints and using |
A test would be good regardless, apparently this code-path wasn't tested before. |
@twiecki, @MarcoGorelli, I have added a test. |
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.
Thanks for adding a test!
Can you also add a note to the release notes?
While making the test more precise, I found that the implementation does not actually support having a model name. The reason is that the model name becomes a prefix to the variable name, which is also used as a kwarg in the line So these prefixes would have to be eliminated from the kwargs, but then the corner case of having nested models is hard to deal with. (yes, that's possible and no, nobody does that because it's very fragile) I'm going to insert this before the if self.model.name:
raise NotImplementedError(
"The SMC implementation currently does not support named models. "
"See https://github.com/pymc-devs/pymc3/pull/4365."
) |
856a708
to
5531aa6
Compare
A test was added to asserts that strace.name is a string (this was not the case before pymc-devs#4365). Non-empty model names are actually not supported (again, see pymc-devs#4365) so attempting to SMC-sample a named model will now raise a NotImplementedError.
Currently, `name` is a `Model`.
A test was added to asserts that strace.name is a string (this was not the case before pymc-devs#4365). Non-empty model names are actually not supported (again, see pymc-devs#4365) so attempting to SMC-sample a named model will now raise a NotImplementedError.
5531aa6
to
9b4bff3
Compare
I just rebased to fix the README conflict. @aloctavodia if you approve, I think we can merge this. |
Currently,
name
is aModel
.Thank your for opening a PR!
Depending on what your PR does, here are a few things you might want to address in the description:
consider adding/updating relevant example notebooks