The Hierarchical Particle Filter Adam M. Johansen and Arnaud Doucet http://go.warwick.ac.uk/amjohansen/talks MCMSki V Lenzerheide 7th January 2016 The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References Context & Outline Filtering in State-Space Models: I SIR Particle Filters [GSS93] I Block-Sampling Particle Filters [DBS06] Exact Approximation of Monte Carlo Algorithms: I Particle MCMC [ADH10] and SMC2 [CJP13] Exact Approximation and Particle Filters: I Approximated RBPFs [CSOL11] Exactly [JWD12] I Hierarchical SMC [Here] I Pseudomarginal State Augmentation: More of the SAME? [Axel Finke; this session] The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References Hidden Markov Models Consider: x1 x2 x3 x4 x5 x6 y1 y2 y3 y4 y5 y6 I Unobserved Markov chain {Xn } transition f . I Observed process {Yn } conditional density g. Density: I p(x1:n , y1:n ) = f1 (x1 )g(y1 |x1 ) n Y f (xi |xi−1 )g(yi |xi ). i=2 The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References Sequential Importance Resampling I Algorithmically, at iteration n: I I I i i , X1:n−1 } for i = 1, . . . , N : Given {Wn−1 ei Resample, obtaining {1/N, X 1:n−1 }. I i en−1 Sample Xni ∼ qn (·|X ) I Weight Wni ∝ i ei i f (Xn |Xn−1 )g(yn |Xn ) ei qn (X i |X ) n n−1 Actually: I I Resample efficiently. Only resample when necessary. The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References Particle MCMC I I MCMC algorithms which employ SMC proposals [ADH10] SMC algorithm as a collection of RVs I I I I Construct MCMC algorithms: I I I I I Values Weights Ancestral Lines With many auxiliary variables Exactly invariant for distribution on extended space Standard MCMC arguments justify strategy SMC2 employs the same approach within an SMC setting. What else does this allow us to do with SMC? The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References Ancestral Trees t=1 t=2 t=3 a13 =1 a43 =3 a12 =1 a42 =3 b23,1:3 =(1, 1, 2) b43,1:3 =(3, 3, 4) b63,1:3 =(4, 5, 6) The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References SMC Distributions Formally gives rise to the SMC Distribution: M an−L+2:n , xn−L+1:n , k; xn−L ψn,L # " "M # n M Y Y Y aip i i r(ap |wp−1 ) q xp |xp−1 r(k|wn ) = q( xn−L+1 xn−L ) i=1 p=n−L+2 i=1 and the conditional SMC Distribution: ek k M k ek e ψen,L a , x ; x b , k, x e n−L n−L+1:n−1 n−L+1:n n−L+2:n n−L+1:n M en−L+1:n , k; xn−L ) ψn,L (e an−L+2:n , x " = # ebk n e e Q bk bn n,n−L+1 n,p n,p−1 k e e p−1 q x e n) q x en−L+1 |xn−L r bn,p |w ep |e xp−1 r(k|w p=n−L+2 The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References Block Sampling: An Idealised Approach At time n, given x1:n−1 ; discard xn−L+1:n−1 : I Sample from q(xn−L+1:n |xn−L , yn−L+1:n ). I Weight with W (x1:n ) = I p(x1:n |y1:n ) p(x1:n−L |y1:n−1 )q(xn−L+1:n |xn−L , y1:n−L+1:n ) Optimally, q(xn−L+1:n |xn−L , yn−L+1:n ) =p(xn−L+1:n |xn−L , yn−L+1:n ) p(x1:n−L |y1:n ) W (x1:n ) ∝ =p(yn |x1:n−L , yn−L+1:n−1 ) p(x1:n−L |y1:n−1 ) I Typically intractable; auxiliary variable approach in [DBS06]. The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References Local Particle Filtering: Current Trajectories Starting Point 4 2 0 −2 −4 0 2 The Hierarchical Particle Filter Adam M. Johansen 4 6 8 n 10 12 14 16 Introduction Block Sampling Particle Filters References Local Particle Filtering: PF Proposal PF Step 4 2 0 −2 −4 0 2 The Hierarchical Particle Filter Adam M. Johansen 4 6 8 n 10 12 14 16 Introduction Block Sampling Particle Filters References Local Particle Filtering: CPF Auxiliary Proposal CPF Step 4 2 0 −2 −4 0 2 The Hierarchical Particle Filter Adam M. Johansen 4 6 8 n 10 12 14 16 Introduction Block Sampling Particle Filters References Local SMC: Version 1 I I Not just a Random Weight Particle Filter. Propose from: ⊗n−1 M U1:M (b1:n−2 , k)p(x1:n−1 |y1:n−1 )ψn,L (an−L+2:n , xn−L+1:n , k; xn−L ) M ek ek ψen−1,L−1 a n−L+2:n−1 , x n−L+1:n−1 ; xn−L ||bn−L+2:n−1 , xn−L+1:n−1 I Target: k̄ b n,n−L+1:n ⊗n U1:M (b1:n−L , b̄k̄n,n−L+1:n−1 , k̄)p(x1:n−L , xn−L+1:n |y1:n ) k̄ k̄ bn,n−L+1:n k k M e ψn,L an−L+2:n , xn−L+1:n ; xn−L b̄n,n−L+1:n , xn−L+1:n M en−L+1:n−1 , k; xn−L ) . ψn−1,L−1 (e an−L+2:n−1 , x I Weight: Z̄n−L+1:n /Zen−L+1:n−1 . The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References Stochastic Volatility Bootstrap Local SMC I Model: f (xi |xi−1 ) =N φxi−1 , σ 2 g(yi |xi ) =N 0, β 2 exp(xi ) I Top Level: I I I Local SMC proposal. Stratified resampling when ESS< N/2. Local SMC Proposal: I Proposal: q(xt |xt−1 , yt ) = f (xt |xt−1 ) I Weighting: W (xt−1 , xt ) ∝ I f (xt |xt−1 )g(yt |xt ) = g(yt |xt ) f (xt |xt−1 ) Resample residually every iteration. The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References SV Exchange Rata Data Exchange Rate Data 5 4 Observed Values 3 2 1 0 −1 −2 −3 −4 0 100 200 300 400 500 600 700 800 900 n The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References SV Bootstrap Local SMC: M=100 N = 100, M = 100 100 Average Number of Unique Values 90 80 70 L=2 L=4 L=6 L = 10 60 50 40 30 20 10 0 0 100 200 300 400 500 600 700 800 900 n The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References SV Bootstrap Local SMC: M=1000 N = 100, M = 1000 100 Average Number of Unique Values 90 80 70 60 L=2 L=4 L=6 L = 10 L = 14 L = 18 50 40 30 20 10 0 0 100 200 300 400 500 600 700 800 900 n The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References SV Bootstrap Local SMC: M=10000 N=100, M=10,000 100 Average Number of Unique Values 90 80 70 60 50 L=2 L=4 L=6 L = 10 L = 14 L = 18 L = 22 L = 26 40 30 20 10 0 0 100 200 300 400 500 600 700 800 900 n The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References Local SMC: Version 2 Problems with this PF+CPF scheme: I Expensive to run 2 filters per proposal. . . I and large M is required. . . I can’t we do better? Using a non-standard CPF/PF proposal is preferable: I Running a CPF from time n − L + 1 to n, I and extending it’s paths with a PF step to n + 1, I invoking a careful auxiliary variable construction, I we reduce computational cost and variance. I Leads to importance weights: bk ∝ n−1,n−L p̂(yn−L+1:n |xn−L ) bk n−1,n−L p̂(yn−L+1:n−1 |xn−L ) The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References Hierarchical Particle Filtering: Current Trajectories Starting Point 7 6 5 4 3 2 1 0 -1 -2 0 2 4 6 8 10 12 14 16 n The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References Hierarchical Particle Filtering: CPF Proposal Component CPF Step 7 6 5 4 3 2 1 0 -1 -2 0 2 4 6 8 10 12 14 16 n The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References Hierarchical Particle Filtering: PF Proposal Component PF Step 7 6 5 4 3 2 1 0 -1 -2 0 2 4 6 8 10 12 14 16 n The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References A Toy Model: Linear Gaussian HMM I Linear, Gaussian state transition: f (xt |xt−1 ) = N (xt ; xt−1 , 1) I and likelihood g(yt |xt ) = N (yt ; xt , 1) I Analytically: Kalman filter/smoother/etc. I Simple bootstrap HPF: I Local proposal: q(xt |xt−1 , yt ) = f (xt |xt−1 ) I Weighting: W (xt−1 , xt ) ∝ g(yt |xt ) The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References ● 3 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● N ● ● ● ● ● 100 ● ● ● ● ● 1000 ● 10000 ● ● 1e+05 2 ● ● M ● ● 1 ● rZ ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 1 ● ● ● ● ● ● 2 ● ● ● 4 8 16 32 64 ● ● 128 ● ● 256 ● ● ● ● ● 512 ● 1024 ● Bo o tst 4 rap 0 L The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References 2 N ● 100 1000 10000 ● ● ● ● ● ● ● ● 1e+05 ● 0 ● ● ● ● M 1 ● 2 4 log(rZ) ● 8 ● 16 32 −2 64 128 256 512 1024 L −4 4 00 10 00 0 12 80 0 16 00 0 25 60 0 32 00 0 51 20 0 64 00 0 1e +0 5 10 24 00 12 80 00 20 48 00 25 60 00 40 96 00 51 20 00 10 24 00 0 20 48 00 0 40 96 00 0 00 80 0 00 64 32 16 80 00 Bootstrap C The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References In Conclusion I SMC can be used hierarchically. I Software implementation is not difficult [Joh09, Zho13, Mur13, TCF+ 14]. I The optimal block-sampling particle filter can be approximated exactly I but at a considerable computational cost. I Many related things are also possible. . . I I I EA-RBPFs [JWD12] Tempering in blocks [Joh15] Iterated Particle Filters [GJL15] The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References References I [ADH10] C. Andrieu, A. Doucet, and R. Holenstein. Particle Markov chain Monte Carlo. Journal of the Royal Statistical Society B, 72(3):269–342, 2010. [CJP13] N. Chopin, P. Jacob, and O. Papaspiliopoulos. SMC2 : an efficient algorithm for sequential analysis of state space models. Journal of the Royal Statistical Society B, 75(3):397–426, 2013. [CSOL11] T. Chen, T. Schön, H. Ohlsson, and L. Ljung. Decentralized particle filter with arbitrary state decomposition. IEEE Transactions on Signal Processing, 59(2):465–478, February 2011. [DBS06] A. Doucet, M. Briers, and S. Sénécal. Efficient block sampling strategies for sequential Monte Carlo methods. Journal of Computational and Graphical Statistics, 15(3):693–711, 2006. [GJL15] P. Guarniero, A. M. Johansen, and A. Lee. The iterated auxiliary particle filter. ArXiv mathematics e-print 1511.06286, ArXiv Mathematics e-prints, 2015. [GSS93] N. J. Gordon, S. J. Salmond, and A. F. M. Smith. Novel approach to nonlinear/non-Gaussian Bayesian state estimation. IEE Proceedings-F, 140(2):107–113, April 1993. [Joh09] A. M. Johansen. SMCTC: Sequential Monte Carlo in C++. Journal of Statistical Software, 30(6):1–41, April 2009. [Joh15] A. M. Johansen. On blocks, tempering and particle MCMC for systems identification. In Proceedings of 17th IFAC Symposium on System Identification, Beijing, China., 2015. IFAC. To appear. Invited submission. [JWD12] A. M. Johansen, N. Whiteley, and A. Doucet. Exact approximation of Rao-Blackwellised particle filters. In Proceedings of 16th IFAC Symposium on Systems Identification, pages 488–493, Brussels, Belgium, July 2012. IFAC, IFAC. [Mur13] L. M. Murray. Bayesian state-space modelling on high-performance hardware using LibBi. Mathematics e-print 1306.3277, ArXiv, 2013. [TCF+ 14] A. Todeschini, F. Caron, M. Fuentes, P. Legrand, and P. Del Moral. Biips: Software for Bayesian inference with interacting particle systems. Mathematics e-print, ArXiv, 2014. [Zho13] Y. Zhou. vSMC: Parallel sequential Monte Carlo in C++. Mathematics e-print 1306.5583, ArXiv, 2013. The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References Key Identity M ψn,L (an−L+2:n , xn−L+1:n , k; xn−L ) k M (ak p(xn−L+1:n |xn−L , yn−L+1:n )ψen,L n−L+2:n , xn−L+1:n , k; xn−L ||. . . ) " k k # n Q bn,n−L+1 bn,p bn n,p−1 k q xn−L+1 |xn−L r bn,p |wp−1 q xp |xp−1 r(k|wn ) = p=n−L+2 p(xn−L+1:n |xn−L , yn−L+1:n ) b =Zn−L+1:n /p(yn−L+1:n |xn−L ) The Hierarchical Particle Filter Adam M. Johansen Introduction Block Sampling Particle Filters References