-
Notifications
You must be signed in to change notification settings - Fork 228
Do not take an initial step before starting the chain in HMC #2674
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
Conversation
Turing.jl documentation for PR #2674 is available at: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2674 +/- ##
==========================================
- Coverage 85.86% 85.79% -0.07%
==========================================
Files 22 22
Lines 1429 1422 -7
==========================================
- Hits 1227 1220 -7
Misses 202 202 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Pull Request Test Coverage Report for Build 17642662193Details
💛 - Coveralls |
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.
In general, no objection. The failed tests also look unrelated, so good.
On versioning, do you think this constitute a breaking change? Not saying I do, but worth second thought.
I think generally for random results we shouldn't guarantee the exact numerical results as being part of the API, but we should guarantee some statistical properties. Since this doesn't change convergence properties for MCMC I think it's fine to put as a bugfix. I guess this isn't an official policy though so maybe worth checking if we all agree? |
My concern is the behavior of initialization. Before this PR, the initialization wasn't returned in the chain. |
There is actually a subtle change that I just realised with this: when the initial state is included, then there are no sampler stats for the first entry in the chain (because the sampler hasn't run). That means they all get a value of Because MCMCChains requires a consistent eltype for all parameters + stats, this means that all the parameters are stored as julia> using Turing; @model f() = x ~ Normal(); c = sample(f(), HMC(0.1, 5), 100)
Sampling 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| Time: 0:00:00
Chains MCMC chain (100×13×1 reshape(::Matrix{Union{Missing, Float64}}, 100, 13, 1) with eltype Union{Missing, Float64}):
Iterations = 1:1:100
Number of chains = 1
Samples per chain = 100
Wall duration = 0.26 seconds
Compute duration = 0.26 seconds
parameters = x
internals = hamiltonian_energy, n_steps, numerical_error, loglikelihood, hamiltonian_energy_error, is_accept, logprior, log_density, step_size, acceptance_rate, lp, nom_step_size
Use `describe(chains)` for summary statistics and quantiles.
julia> eltype(c[:x])
Union{Missing, Float64} On main, This to me is not actually a Turing problem. It's an MCMCChains problem. But I wonder if that would factor into the decision. |
i'll change the base to |
97ce752
to
3ebd958
Compare
Closes #2673