Skip to content

Conversation

junpenglao
Copy link
Member

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.

Junpeng Lao added 2 commits December 8, 2017 11:34
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.
nchain = trace.nchains
try:
nchain = trace.nchains

Copy link
Member

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
Copy link
Member

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?

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 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)

Copy link
Member

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

Copy link
Member Author

@junpenglao junpenglao Dec 8, 2017

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?

Copy link
Member

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?

@aloctavodia aloctavodia merged commit a395e97 into pymc-devs:master Dec 8, 2017
@junpenglao junpenglao deleted the bug_fix_sample_ppc branch December 9, 2017 07:50
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