Skip to content

Conversation

@junpenglao
Copy link
Member

@junpenglao junpenglao commented Jun 13, 2017

This is a temporary solution!!!
Related/same issue including: #2076, #2109
Behavior:
1, The user supplied start value is taken as priority (same as before the fix)
2, if there is transformed RV conditioned on another free_RV, the start value will be ignore (due to error in #2258)
3, No more error using default init in situation 2:

with pm.Model() as model:
    a1 = pm.Uniform('a1', lower=0., upper=1.)
    b1 = pm.Uniform('b1', lower=0., upper=1. - a1)
    pm.sample()

Junpeng Lao added 2 commits June 13, 2017 10:17
This is a temporary solution!!! 
Behavior: 1, The user supply start value is taken as priority (same as before the fix)
2, if there is transformed RV conditioned on another free_RV, the start value will be ignore (due to error in #2258)
3, No more error using default init in situation 2.
if is_transformed_name(tname) and get_untransformed_name(tname) == name:
transform_func = [d.transformation for d in model.deterministics if d.name == name]
if transform_func:
b[tname] = transform_func[0].forward(a[name]).eval()
Copy link
Member

Choose a reason for hiding this comment

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

Use tag.test_value instead

Copy link
Member

Choose a reason for hiding this comment

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

Hmm

Copy link
Member

Choose a reason for hiding this comment

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

I'm wrong

Copy link
Member

Choose a reason for hiding this comment

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

Try it out please. I was confused by the shortcut pymc3.sampling above the codeblock and thought it is internals of sampling. Seems like it can be the right solution as it is executed once.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure I understand what you mean - if you find a solution you can push to this branch.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the best solution is recompiled the graph using something like _compile_theano_function similar to distribution.draw_value. However, we always need to feed a dictwith the right input to the new compiled function as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

cc @aseyboldt as he mention he might refactor _compile_theano_function for #2296

@junpenglao
Copy link
Member Author

Close in favor of #2328

@junpenglao junpenglao closed this Jun 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants