-
-
Notifications
You must be signed in to change notification settings - Fork 272
sampler stats #95
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
sampler stats #95
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
deleted PR Samplerstats(WIP) #94 and created this, will take care of comments made there and make a commit, sorry about the inconvenience, i tried resetting to an initial commit and that messed up the previous PR so started it again |
I tried @OriolAbril also can you mark the useless plot again, since that pr has 0 commits i cannot see the location of those comments I'm not very sure if this plot is better than the previous one: finally im so sorry i made these comments on the issue you referenced the PR in, instead of here, deleted those and put them here |
Let's go with The plot step_size bar is the one I find useless, we should just remove it and be done with it. The comment about using |
@@ -14,29 +14,40 @@ | |||
}, |
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.
dims and coords seem to have been ignored, could be a bug in ArviZ. I'll look into that. Do change this for the plot anyway though, even if at least for now the labels are wrong. Using plot_posterior
like we did above should work here too.
Reply via ReviewNB
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.
okayy, could it be because we didn't refer to dims in step1 and step2
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.
ArviZ ignores the dimensions for sample stats: https://github.com/arviz-devs/arviz/blob/main/arviz/data/io_pymc3.py#L323 it may be to avoid name collisions though.
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.
do you think that could use some fixing, maybe an informative warning or error could be given during a name collision. Because in real time models and stuff diagnostics running well, following general practices of arviz/pymc3 seems to be actually very important
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.
Yes, we could fix that in ArviZ and have it use coords and dims also in the sample stats, either with a try except or checking things more carefully. But this is very low priority, compound steps are not that common and we have to make sure to implement that in a way that it never backfires.
made some changes(experimental) |
@michaelosthege can you explain what are perf_counter_diff , process_time_diff and perf_counter_start? Or point us to an issue or PR about them? |
hi, maybe this comment wasn't notified or something because it was in the reviewnb thing, |
i think it still doesn't open in the mobile app, so im copying the comment here: @OriolAbril no problem at all! also I just checked and the items ive added are the exact same, I went through the code for sample_stats_to_array here , that clarified it for me. thanks anyway this looks like a helpful comment. this is from the current commit on the notebook, in case you wanted to see(only tune needs to go i think) |
here is the relevant documentation |
Yeah, I am seeing it now, sorry about that. Thanks for looking into this. |
You are right that now all the relevant variables are present, only Regaring the |
thanks!! and yeah that is somewhat weird, all i could find in metropolis.py was: Also tune is a stat in metropolis.py but I don't see it in sample_stats, so I'm a little confused about whether it should be needed or not. I think it got removed because of the compound step thing, if it's there in a single model sampling for metropolis dist. then we might need it? |
I looked at the original notebook once again, and possibly the reason why they chose to show accept, was just that it was common in both the samplers, which might not be a good enough reason for an elaborate plot which also has outliers. I might be entirely wrong here, I'm just speculating. |
I took a look at that, now it make sense. In metropolis one generates a proposal
yes, this sounds right, our goal here should probably be to show that when using a compound step, the common variables in sample_stats will get an extra dimension, one per sampler. |
yeah, that makes sense, thanks for explaining, i just started reading up about it and noticed acceptance rate was important for metropolis hastings.
In that case, the last plot is unnecessary, but possibly showing the range of accept on both the samplers, would make some sense? |
In metropolis it's
Yes, I think that showing how to work with sample stats that have multiple steps is useful and won't be explained anywhere else probably |
yes, my bad, ive been looking at nuts doc. over and over for the stats thing sort of fixated in my head.
yes we can do that, also I think a detailed explanation could be added here as well - compound step notebook |
good catch, I think I haven't gotten to create the issue for that notebook, I don't remember ever reading it until now. |
thanks! I haven't come across an issue on that, if you want I can make one, or I can directly make a draft PR too, whichever seems better? |
I will create an issue now |
sure! |
can you restart and run all on the notebook? This should get rid of this warning in the last cell due to having executed it twice:
|
@OriolAbril done, it can be merged now |
This notebook uses InferenceData and ArviZ for plotting. Explains multi-step sampler_stats as well.
Changed sampler_stats description according to - https://arviz-devs.github.io/arviz/schema/schema.html#sample-stats
Addresses issue #46