Kernel: Python [conda env:py3713]
SMC sequential inference for a static parameter (IBIS) for 1d Gaussian
The model is .
Code is from: https://github.com/nchopin/particles/blob/master/docs/source/notebooks/SMC_samplers_tutorial.ipynb
In [12]:
In [2]:
In [3]:
We run IBIS with 20 particles, using 50 MCMC iterations per time step (data point). We use "waste free" SMC, so we generate 50*20=1000 samples in total per step.
In [4]:
Out[4]:
t=0, ESS=58.14
t=1, Metropolis acc. rate (over 49 steps): 0.209, ESS=499.06
t=2, Metropolis acc. rate (over 49 steps): 0.170, ESS=675.50
t=3, ESS=376.27
t=4, Metropolis acc. rate (over 49 steps): 0.244, ESS=583.01
t=5, ESS=103.19
t=6, Metropolis acc. rate (over 49 steps): 0.486, ESS=904.26
t=7, ESS=795.64
t=8, ESS=571.89
t=9, ESS=361.04
t=10, Metropolis acc. rate (over 49 steps): 0.363, ESS=934.31
t=11, ESS=788.41
t=12, ESS=649.73
t=13, ESS=555.55
t=14, ESS=631.81
t=15, ESS=503.48
t=16, ESS=412.39
t=17, Metropolis acc. rate (over 49 steps): 0.317, ESS=920.21
t=18, ESS=952.02
t=19, ESS=814.36
t=20, ESS=875.37
t=21, ESS=914.19
t=22, ESS=750.37
t=23, ESS=803.78
t=24, ESS=773.84
t=25, ESS=808.32
t=26, ESS=827.16
t=27, ESS=828.41
t=28, ESS=639.55
t=29, ESS=646.82
CPU times: user 739 ms, sys: 108 ms, total: 847 ms
Wall time: 842 ms
In [5]:
Out[5]:
1000
In [6]:
Out[6]:
(30, 1000)
Below we show the histogram of samples at two time steps for each parameter. We see that the posterior concentrates on the true values.
In [14]:
In [17]:
Out[17]:
/home/patel_karm/sendbox/probml-utils/probml_utils/plotting.py:71: UserWarning: renaming figures/ibis-post-histo.pdf to figures/ibis-post-histo_latexified.pdf because LATEXIFY is True
f"renaming {fname_full} to {fname}{extention} because LATEXIFY is {LATEXIFY}",
saving image to figures/ibis-post-histo_latexified.pdf
Figure size: [3. 1.5]
In [20]:
Out[20]:
saving image to figures/ibis-ESS-vs-time_latexified.pdf
Figure size: [3. 1.5]
In [10]:
Out[10]:
dict_keys(['rs_flag', 'chol_cov', 'acc_rates'])
In [11]:
Out[11]:
6
0.20924065735778064
0.17029554784643025
0.24416637113848005
0.4862693673596949
0.36317537998270405
0.3167837518528394
In [ ]: