Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Multi-model and Rao-Blackwellised versions of particle filter #719

Merged
merged 11 commits into from
Feb 21, 2023

Conversation

sdhiscocks
Copy link
Member

@sdhiscocks sdhiscocks commented Sep 16, 2022

This is a squash and clean up of commits from pull request #271, adapted to work with changes on the main branch.

TODO:

  • Vectorise particles
  • Remove new resamplers (these shouldn't be required once vectorised, as can use from_state method)
  • Improve tests
  • Add example (to be done in separate PR)

This is a squash and clean up of commits from pull request #271, adapted
to work with changes on the `main` branch.
@sdhiscocks sdhiscocks mentioned this pull request Sep 16, 2022
@codecov
Copy link

codecov bot commented Sep 16, 2022

Codecov Report

Base: 94.66% // Head: 94.82% // Increases project coverage by +0.16% 🎉

Coverage data is based on head (53a67b9) compared to base (2b69b97).
Patch coverage: 96.31% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #719      +/-   ##
==========================================
+ Coverage   94.66%   94.82%   +0.16%     
==========================================
  Files         171      168       -3     
  Lines        8773     8333     -440     
  Branches     1707     1241     -466     
==========================================
- Hits         8305     7902     -403     
+ Misses        342      319      -23     
+ Partials      126      112      -14     
Flag Coverage Δ
integration 68.73% <37.42%> (-1.29%) ⬇️
unittests 92.61% <96.31%> (+1.86%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
stonesoup/updater/particle.py 95.96% <90.69%> (-2.80%) ⬇️
stonesoup/predictor/particle.py 92.95% <95.65%> (+4.95%) ⬆️
stonesoup/resampler/particle.py 100.00% <100.00%> (ø)
stonesoup/types/particle.py 100.00% <100.00%> (ø)
stonesoup/types/prediction.py 100.00% <100.00%> (ø)
stonesoup/types/state.py 100.00% <100.00%> (ø)
stonesoup/types/update.py 100.00% <100.00%> (ø)
stonesoup/base.py
stonesoup/plotter.py
stonesoup/__init__.py
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

This returns a new ParticleState, only containing relevant particles
This also modifies use of measurement model covariance to transition
model covariance in Rao Blackwellised update step.

New states for multi-model and Rao Blackwellised have also been created
to enable capture of the overall state.

Test has been improved for Rao Blackwellised to ensure behaviour is as
expected, increasing probability for transition models that align with
measurements.

Custom resamplers for these filters have also been removed as standard
one can now be used.
As both testing form of multi model test, the files have been combined,
so they can share fixtures.
@sdhiscocks sdhiscocks marked this pull request as ready for review September 26, 2022 10:48
@sdhiscocks sdhiscocks requested a review from a team as a code owner September 26, 2022 10:48
@sdhiscocks sdhiscocks requested review from hpritchett-dstl and orosoman-dstl and removed request for a team September 26, 2022 10:48
Copy link
Contributor

@hpritchett-dstl hpritchett-dstl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've attempted implementing the Multi-model and Rao-Blackwellised particle filters in the following notebook:
https://gist.github.com/hpritchett-dstl/a42124667bb4fe10e734d5c57c6db3d8
These filters are a great addition to Stone Soup. I only ran into a couple problems (assuming i'm using it correctly!) when making the notebook. Those problems are at the bottom of the notebook, I will also mention them at the relevant points in this PR. 😃

This avoids use of Probability type which isn't designed for use in
large array calculations.
@sdhiscocks sdhiscocks merged commit 68f5dd9 into main Feb 21, 2023
@sdhiscocks sdhiscocks deleted the mmrbpf branch February 27, 2023 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants