Conversation
|
Turing.jl documentation for PR #2789 is available at: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2789 +/- ##
===========================================
- Coverage 86.34% 20.21% -66.13%
===========================================
Files 22 23 +1
Lines 1435 1588 +153
===========================================
- Hits 1239 321 -918
- Misses 196 1267 +1071 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@penelopeysm I am running into the following issue when touching up my implementation. Suppose we run the following simple example using Random
using Turing
@model function linear_regression(x, y)
β ~ Normal(0, 1)
σ ~ truncated(Cauchy(0, 3); lower=0)
for t in eachindex(x)
y[t] ~ Normal(β * x[t], σ)
end
end
# condition the model
rng = MersenneTwister(1234)
x, y = rand(rng, 10), rand(rng, 10)
reg_model = linear_regression(x, y)
rng = MersenneTwister(1234)
particles = sample(rng, reg_model, SMC(0.5), 512, ensemble=MCMCSerial());Where I get the following error: ExceptionStackNot entirely sure why this is considering when I run this outside of the Turing environment (same exact code from |
|
First, I found that |
I fixed this locally, but forgot to commit to the PR Co-authored-by: Penelope Yong <penelopeysm@gmail.com>
|
This PR TuringLang/Libtask.jl#219 should fix the Libtask errors; with that PR + once you add the DynamicPPL imports, it runs correctly for me. If I had to take a guess, it was probably working for you before this because the variables weren't truly global (were they in a function, or some local scope?) |
Co-authored-by: Penelope Yong <penelopeysm@gmail.com>
All it took was the imports, though I appreciate the second look at Libtask. I don't think there's any global manipulation here, unless you count the task local storage trickery used by Libtask. |
|
I don't understand that at all, but if there's no error now, I guess I'll take the win. |
|
(The point about the globals was that if you run the code snippet above in the REPL, then x and y are global variables.) |
Following the latest major release of DynamicPPL, I finally scrapped together my ideas for the long awaited restructuring of SMC within Turing.
Major Changes
TracedModelworks quite differently under the hood. While Libtask is still a central component of this mechanic, theproducecall from accumulation is delayed to ensureVarInfois caught up in terms of log-likelihoods.SMCno longer uses AbstractMCMC to interface; howeverParticleGibbsstill does.AbstractMCMCEnsemblenow interacts with SMC samplers along the reweighting step, which is designed to operate in parallel.TracedRNGhas been removed in favor of a taped global RNG manipulation to facilitate allocation efficient replayability of referenced trajectories in Particle Gibbs.TODO List
The original interface is for the most part replicated in its entirety. There are a handful of minor tweaks I need to make in order to better reinterface with some internal methods.
PartialLogDensity, or something to facilitate a partially observed modelsmcsamplewith MCMCChains/FlexiChains so that its consistent with the rest of the moduleNotes
This is all based on my self contained reimplementation here which serves more as a workspace for demonstration and experimentation. You can think of this PR as a subset of my personal repo; with that being said, I have a couple questions on proper integration:
Lastly, I would really appreciate help with the realization of particle rejuvenation. I have a demo over on TuringSMC which showcases a proof of concept.