-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Incorrect names for multiple identical deterministics #2912
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
Comments
That's a weird one, any idea? |
It seems like it's the expected behavior from Theano, based on this excerpt from the docstring for
|
As @lpsinger pointed out, this is the normal and expected behavior for theano. Theano is basically setting a name to the Maybe the random variables name should be set in a different attribute too? Something like
|
@lucianopaz Thanks for chiming in. Both options don't seem ideal, the former for the code change required the latter for the unforeseeable consequences. If you're up for it, we could experiment with the second version on a branch and just see if tests still pass. |
@twiecki I've tried an MWE that monkey patches a
|
Well, it seems to work :). It's very unfortunate how complex it is to get this done. I guess this could be done easier if we actually implemented this in Theano? Or, could we alternatively subclass |
Yeah, I think that it would be less error prone to subclass something in The problem I think subclassing will bring is that we should subclass all three base types: If we go ahead with subclassing some |
Thanks @lucianopaz, let me know what you find. |
…uted to `Deterministic`, adding the attribute `pymc_name` and changing the way in which the `__getattribute__` and `__setattr__` methods work. Both methods now inpect their call frame to infer whether the call came from inside or outside of the `theano` package. If the call is from inside `theano`, both methods work as usual, but from outside of `theano`, the way in which the `name` attribute is handled is changed. From outside `theano`, the `name` attribute will be handled as an alias for the `pymc_name` attribute. The added attribute, required some extra care to not break the `__eq__`, `__ne__`, `__hash__`, `clone` and `clone_with_new_inputs` methods. Furthermore, as the class is dynamically constructed, the `__reduce__` method was changed in order to still be able to pickle models.
If you have multiple deterministics with the same values, then all of their names are incorrectly set to the name of the last deterministic. Here's an example:
Notice that both deterministics are named
bar
, whereas the first one should be namedfoo
and the second one namedbar
.Versions and main components
The text was updated successfully, but these errors were encountered: