Skip to content

Commit

Permalink
filters.ParticleFilter.bayes(): ignore cond (at least for now)
Browse files Browse the repository at this point in the history
  • Loading branch information
strohel committed Oct 24, 2012
1 parent 378828b commit cd4d904
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions ChangeLog.rst
Expand Up @@ -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.)
Expand Down
8 changes: 2 additions & 6 deletions pybayes/filters.py
Expand Up @@ -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)`.
Expand All @@ -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]))
Expand Down

0 comments on commit cd4d904

Please sign in to comment.