Permalink
Browse files

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

  • Loading branch information...
1 parent 378828b commit cd4d904d5c43f19069c35eedde8018c56aa5f81f @strohel committed Aug 29, 2012
Showing with 3 additions and 6 deletions.
  1. +1 −0 ChangeLog.rst
  2. +2 −6 pybayes/filters.py
View
1 ChangeLog.rst
@@ -8,6 +8,7 @@ recent versions are mentioned on top.
Changes between 0.3 and 0.4
===========================
+* ParticleFilter.bayes() now ignores cond completely. Yell if you need it.
* ParticleFilter lost last emp_pdf argument. Pass the same object as the init_pdf argument
to achieve the same thing.
* Test-suite no longer needs PyBayes to be installed, yay! (no privilege problems etc.)
View
8 pybayes/filters.py
@@ -286,7 +286,7 @@ def __init__(self, n, init_pdf, p_xt_xtp, p_yt_xt):
self.emp = EmpPdf(init_pdf.samples(n))
def bayes(self, yt, cond = None):
- r"""Perform Bayes rule for new measurement :math:`y_t`.
+ r"""Perform Bayes rule for new measurement :math:`y_t`; *cond* is ignored.
:param numpy.ndarray cond: optional condition that is passed to :math:`p(x_t|x_{t-1})`
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):
"""
for i in range(self.emp.particles.shape[0]):
# generate new ith particle:
- if cond is None:
- aggregate_cond = self.emp.particles[i]
- else:
- aggregate_cond = np.concatenate((self.emp.particles[i], cond))
- self.emp.particles[i] = self.p_xt_xtp.sample(aggregate_cond)
+ self.emp.particles[i] = self.p_xt_xtp.sample(self.emp.particles[i])
# recompute ith weight:
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.