-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
sample_ppc bug fix #2748
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
sample_ppc bug fix #2748
Conversation
My fix in #2725 to use all chains breaks the `sample_ppc([point]...)` and also the progress bar. These issue should be fix here now and also add test for sample_ppc from a list.
pymc3/sampling.py
Outdated
nchain = trace.nchains | ||
try: | ||
nchain = trace.nchains | ||
|
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.
unnecessary space
nchain = tr.nchains | ||
len_trace = len(tr) | ||
try: | ||
nchain = tr.nchains |
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.
Why the try/except? tr.nchains
works even for traces with only 1 chain, right?
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.
Not work if you pass a list, it doesnt have .nchains
. For example, you can do:
with model:
map1 = pm.find_MAP()
ppc = pm.sample_ppc([map1], sample=100, model=model)
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.
but sample_ppc_w
is always expecting a list of traces
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.
yeah I was thinking the same, but it is a bit of a corner case as sample_ppc
allows a list, and sample_ppc_w should as well, something like:
sample_ppc_w([[map1], [map2]], [model1, model2])
what do you think?
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.
You are right, a general solution is a better option.
Could you add a line in the doctring of sample_ppc_w
, something similar as what you did for sample_pcc
?
My fix in #2725 to use all chains breaks the
sample_ppc([point]...)
and also the progress bar. These issue should be fix here now and also add test for sample_ppc from a list.