Please see this repository for our open-source implementation of SMCP3, and pedagogical content on SMCP3.
This repository contains the code used to generate the results and figures for the paper
SMCP3: Sequential Monte Carlo with Probabilistic Program Proposals
(Alex Lew*, George Matheos*, Tan Zhi-Xuan, Matin Ghavamizadeh, Nishad Gothoskar, Stuart Russell, Vikash Mansinghka)
AISTATS 2023
Julia/
contains the code used to run our experiments, not using the automated implementation of SMCP3 in Gen.Gen/
contains code implementing the automated implementation of SMCP3 in Gen, and implementations of some of our examples models and inference programs using this Gen support for SMCP3.
- Figure 3
- Left:
Julia/StateEstimation/time_plot.jl
- Right:
Julia/MixtureModel/gaussian/gaussian_figure.jl
- Left:
- Figure 5:
Julia/StateEstimation/plot_particles.jl
- Figure 6 plot:
Julia/Object3D/run_experiments.sh
generates the data (to run, call./run_experiments.sh
from withinJulia/Object3D/
);Julia/Object3D/make_plot.jl
is used to render the plot. - Table 1
- State-space model:
Julia/StateEstimation/100d_table.jl
- Mixture model (Medicare data):
Julia/MixtureModel/string/string-experiment.jl
- State-space model:
- Figure 8:
Julia/StateEstimation/100d_time_plot.jl
- Table 2:
Julia/MixtureModel/string/string-experiment.jl
examples/
contains implementations of the SMCP3 algortihms from Sec. 4.1 and 4.2 of the paper, using our implementation of automated SMCP3 support in Gen.examples/StateEstimation
contains an implementation of our inference algorithm for the 1D object tracking model from noisy position observations (sec. 4.1).examples/MixtureModel
contains an implemenation of our inference algorithm for DPMMs (sec. 4.2).
lib/
contains our implementation of automated SMCP3 support for Gen.lib/DynamicForwardDiff.jl
is a custom library for automatic differentiation on trace-shaped data.lib/GenTraceKernelDSL.jl
is the main library providing support for SMCP3. This exposes the@kernel
macro used for writing probabilistic programs implementing SMCP3 kernels, and adds a method to theGen.particle_filter_step!
function for performing an SMCP3 step using kernels written in this DSL. (This library also provides support for involutive MCMC using proposal programs written in this same DSL.) For our implementation of SMCP3, seelib/GenTraceKernelDSL.jl/src/inference.jl
.
- Download Julia.
- Activate and instantiate the Julia package. (From the Julia repl, type
]activate
then]instantiate
.) - Run the Julia scripts in the package.