-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Ensure auto-transformed variables use specified starting values #2046
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
Conversation
…ed variables are initialized with values specified by the user on the original variable
… properly transformed
This turned out to be much harder than I had anticipated. Interval transforms require bound information in order to properly transform values. This update now encodes the bound info into the transformed variable name, if it is a bounded or interval transform. So, for example:
now becomes:
for example. I'm not sure I like this, but I don't see any easy way to supply this information so that starting values can be properly transformed. Please review. cc @twiecki |
pymc3/model.py
Outdated
except KeyError: | ||
pass | ||
if bound_dict['a'] is not None or bound_dict['b'] is not None: | ||
transformed_name += '({},{})_'.format(bound_dict['a'], bound_dict['b']) | ||
self.transformed = model.Var( |
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.
Can't we monkey-patch lower
and upper
onto self.transformed
? While not clean, it would be cleaner than this.
I have no problem adding this to the name, but a problem with reading it out. This is definitely a point where we should take a step back and think how we painted ourselves into this corner. |
I agree. Probably time to overhaul the initialization procedure. |
OK, this should suffice. I have just pushed the |
…ed variables are initialized with values specified by the user on the original variable
… properly transformed
…o transformed_init_fix
pymc3/blocking.py
Outdated
@@ -91,6 +94,98 @@ def mapf(self, f): | |||
return Compose(f, self.rmap) | |||
|
|||
|
|||
class ListArrayOrdering(object): |
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.
This shouldn't show up.
Fixed. |
Not sure I see how this fixes the issue? |
It transforms initial values specified on the original scale and inserts them into the start dict for the transformed variable. |
There is an example in the test. |
I get it now. Much cleaner than before, the only nit-pick is that |
I can revert it to a general function and decorate it if you like. |
Is the function used anywhere else? Maybe we can just rename it. |
Not used elsewhere. I've renamed it. |
Cool, LGTM. |
Currently starting values specified for variables that are auto-transformed are ignored by
sample
. This adds a function_transformed_init
which ensures these values are properly transformed and included in thestart
dict.Closes #2042