自举过滤器/粒子过滤器算法(理解)


12

我对引导过滤器的工作原理确实缺乏了解。我大致了解这些概念,但无法掌握某些细节。这个问题对我来说很清楚。在这里,我将从doucet的参考中使用这种流行的过滤算法(到目前为止,我认为这是最简单的参考)。首先让我告诉你,我的问题是了解哪些分布是已知的,哪些分布是未知的。

自举过滤器

这些是我的问题:

  1. p(xt|xt1(i))t
  2. p(yt|x~t(i))wt(i)=w~t(i)i=1Nw~t(i)xw
  3. 如果有人可以使用众所周知的发行版来使用此引导过滤器,给出一个简单的玩具示例,我将不胜感激。引导过滤器的最终目标对我来说并不明确。

Answers:


10
  1. xtp(xt|xt1) p(xt|x0:t1,y1:t)

  2. x~xw~wx

  3. p(xt|y1:t)tt

考虑简单的模型:

Xt=Xt1+ηt,ηtN(0,1)
X0N(0,1)
Yt=Xt+εt,εtN(0,1)

YXp(Xt|Y1,...,Yt)

Xt|Xt1N(Xt1,1)
X0N(0,1)
Yt|XtN(Xt,1)

应用算法:

  1. NX0(i)N(0,1)

  2. X1(i)|X0(i)N(X0(i),1)N

    w~t(i)=ϕ(yt;xt(i),1)ϕ(x;μ,σ2)μσ2yt

  3. wtxx0:t(i)

返回第2步,继续处理粒子的重新采样版本,直到我们处理完整个序列为止。

R中的实现如下:

# Simulate some fake data
set.seed(123)

tau <- 100
x <- cumsum(rnorm(tau))
y <- x + rnorm(tau)

# Begin particle filter
N <- 1000
x.pf <- matrix(rep(NA,(tau+1)*N),nrow=tau+1)

# 1. Initialize
x.pf[1, ] <- rnorm(N)
m <- rep(NA,tau)
for (t in 2:(tau+1)) {
  # 2. Importance sampling step
  x.pf[t, ] <- x.pf[t-1,] + rnorm(N)

  #Likelihood
  w.tilde <- dnorm(y[t-1], mean=x.pf[t, ])

  #Normalize
  w <- w.tilde/sum(w.tilde)

  # NOTE: This step isn't part of your description of the algorithm, but I'm going to compute the mean
  # of the particle distribution here to compare with the Kalman filter later. Note that this is done BEFORE resampling
  m[t-1] <- sum(w*x.pf[t,])

  # 3. Resampling step
  s <- sample(1:N, size=N, replace=TRUE, prob=w)

  # Note: resample WHOLE path, not just x.pf[t, ]
  x.pf <- x.pf[, s]
}

plot(x)
lines(m,col="red")

# Let's do the Kalman filter to compare
library(dlm)
lines(dropFirst(dlmFilter(y, dlmModPoly(order=1))$m), col="blue")

legend("topleft", legend = c("Actual x", "Particle filter (mean)", "Kalman filter"), col=c("black","red","blue"), lwd=1)

结果图:在此处输入图片说明

Doucet和Johansen撰写的教程非常有用,请参见此处


X1(i)|X0(i)N(0,1)X1(i)|X0(i)N(X0(i),1)
tintinthong

没错,我修正了错字
克里斯·豪格

这些路径不必重新采样吗?根据其他文献,无需对路径进行采样。我只需要在每个时间步采样粒子。我想知道是否有重新采样路径的原因
tintinthong
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.