Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

filters.ParticleFilter.bayes(): ignore cond (at least for now)

  • Loading branch information...
commit cd4d904d5c43f19069c35eedde8018c56aa5f81f 1 parent 378828b
Matěj Laitl authored

Showing 2 changed files with 3 additions and 6 deletions. Show diff stats Hide diff stats

  1. +1 0  ChangeLog.rst
  2. +2 6 pybayes/filters.py
1  ChangeLog.rst
Source Rendered
@@ -8,6 +8,7 @@ recent versions are mentioned on top.
8 8 Changes between 0.3 and 0.4
9 9 ===========================
10 10
  11 +* ParticleFilter.bayes() now ignores cond completely. Yell if you need it.
11 12 * ParticleFilter lost last emp_pdf argument. Pass the same object as the init_pdf argument
12 13 to achieve the same thing.
13 14 * Test-suite no longer needs PyBayes to be installed, yay! (no privilege problems etc.)
8 pybayes/filters.py
@@ -286,7 +286,7 @@ def __init__(self, n, init_pdf, p_xt_xtp, p_yt_xt):
286 286 self.emp = EmpPdf(init_pdf.samples(n))
287 287
288 288 def bayes(self, yt, cond = None):
289   - r"""Perform Bayes rule for new measurement :math:`y_t`.
  289 + r"""Perform Bayes rule for new measurement :math:`y_t`; *cond* is ignored.
290 290
291 291 :param numpy.ndarray cond: optional condition that is passed to :math:`p(x_t|x_{t-1})`
292 292 after :math:`x_{t-1}` so that is can be rewritten as: :math:`p(x_t|x_{t-1}, c)`.
@@ -302,11 +302,7 @@ def bayes(self, yt, cond = None):
302 302 """
303 303 for i in range(self.emp.particles.shape[0]):
304 304 # generate new ith particle:
305   - if cond is None:
306   - aggregate_cond = self.emp.particles[i]
307   - else:
308   - aggregate_cond = np.concatenate((self.emp.particles[i], cond))
309   - self.emp.particles[i] = self.p_xt_xtp.sample(aggregate_cond)
  305 + self.emp.particles[i] = self.p_xt_xtp.sample(self.emp.particles[i])
310 306
311 307 # recompute ith weight:
312 308 self.emp.weights[i] *= exp(self.p_yt_xt.eval_log(yt, self.emp.particles[i]))

0 comments on commit cd4d904

Please sign in to comment.
Something went wrong with that request. Please try again.