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
Add more statistics and move jitter to transition #124
Conversation
I'm not certain why Travis isn't detecting this PR |
Just see if reopening it will trigger Travis. |
Thanks! Any advice on how to handle |
What if the integrator |
I prefer not because How about the following
How do you think? |
That's a convenient way to do it. I implemented it. I misunderstood what PyMC3's Adaptation uses the nominal step size, so I'll also add a NesterovDualAveraging(δ::AbstractFloat, i::AbstractIntegrator) = NesterovDualAveraging(δ, nominal_step_size(i)) |
Can you explain a bit more? I don't quite catch this point.
Sounds good to me. |
So when one sets the step size, it's really setting a "nominal" step size, since if one jitters for example, the step size can change from step to step. It's the nominal step size that should get adapted (this is how Stan does it). You'd also want to use the nominal step size for HMCDA. If there's a more descriptive term than "nominal", I'm happy to use it; that's just the term Stan uses. |
One more point tangential to this PR is that the way Stan and (I think) PyMC3 implement HMC, the step size is only jittered at the beginning of the transition, not at every step in the transition. As currently implemented, |
You are right. It's the case for NUTS but HMC and HMCDA are fine as there is only a single call for the integrator. But let's also do jitter one time for a transition by moving it to the beginning of Also I think what we could improve is that we don't need make |
So just to be clear, you're recommending 1) making |
Yes exactly! |
Okay, unless there's anything else, I think this is ready to merge. |
PR looks good to me now! |
I will merge it in 2 hours if no objection. |
Add new HMC statistics in TuringLang/AdvancedHMC.jl#124, using conventions in arviz-devs/arviz#854
Add AdvancedHMC's new stats in TuringLang/AdvancedHMC.jl#124 following new ArviZ schema in arviz-devs/arviz#854.
* Reformat * Export from_cmdstan * Document why from_xyz are not always exported * Forward dataset functions * Explicitly call Pandas * Remove unnecessary function * Reimplement conversion from Chains This brings more complete support for Stan-style chains parsing and forwards metadata in info to InferenceData * Extract groups from parameters with keys * Add/move utility functions * Add core function to make inf data from dicts * Reformat * Refactor conversion from MCMCChains * Remove defunct test * Empty commit * Add new HMC stat conversions Add new HMC statistics in TuringLang/AdvancedHMC.jl#124, using conventions in arviz-devs/arviz#854 * Convert Stan style names with indexes to Turing style * Don't assume dict type * Adjust dims for log likelihood * Enforce types of ArviZ's stats entries * Incrementally build InferenceData * Keep column ordering in Pandas * Maintain structure of summary info * Reformat * Add nothing case * Add reshape rule for 3d array * Rename chn to chns * Reimplement section_dict * Remove unused indexify commands * Reformat * Parse comma-separated index style * Add initial MCMCChains tests * Remove isnothing (incompatible with Julia 1.0) * Use dims/coords in test * Test multivariate case * Add internals to test * Test all groups in chain conversion * Reimplement chain to inferencedata/dataset conversions * Test conversion to inferencedata/datasets * Add test for missing -> NaN * Simplify and better document array reshaping * Use existing method * Remove unused function * Add test for info conversion * Add CmdStan tests * Skip CmdStan test on Julia 1.0 * Document from_mcmcchains * Add function for converting dataset to dict * Reimplement from_mcmcchains to support combinations of types * Forward to from_mcmcchains * Document functions * Test dict/dataset conversion
See #123 for discussion
Adds the following statistics:
hamiltonian_energy_error
max_hamiltonian_energy_error
is_adapt
nom_step_size
To-do:
is_adapt
starts astrue
and switches tofalse
after adaptation is overjitter
so that the step size used is accessible for stats. I'd appreciate input on this.I'll submit a PR to Turing so that the new stats fields show up in
internals
instead ofparameters
. Looks like Turing doesn't use AdvancedHMC'ssample
function, so I'll need to add anis_adapt
over there.