-
Notifications
You must be signed in to change notification settings - Fork 134
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
Create regulariser object and MCMC particle regulariser #785
Conversation
… particle regularisation.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #785 +/- ##
==========================================
+ Coverage 94.87% 94.89% +0.02%
==========================================
Files 176 179 +3
Lines 9757 9801 +44
Branches 1938 1942 +4
==========================================
+ Hits 9257 9301 +44
Misses 356 356
Partials 144 144
Flags with carried forward coverage won't be shown. Click here to find out 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 in Codecov by Sentry. |
stonesoup/regulariser/particle.py
Outdated
for detection in detections: | ||
move_meas_likelihood.append(measurement_model.logpdf(detection, moved_particles)) | ||
post_meas_likelihood.append(measurement_model.logpdf(detection, moved_particles)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to save calling logpdf
twice.
for detection in detections: | |
move_meas_likelihood.append(measurement_model.logpdf(detection, moved_particles)) | |
post_meas_likelihood.append(measurement_model.logpdf(detection, moved_particles)) | |
for detection in detections: | |
likelihood = measurement_model.logpdf(detection, moved_particles) | |
move_meas_likelihood.append(likelihood) | |
post_meas_likelihood.append(likelihood) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, is this an error, and they shouldn't be the same? From variable names looks like it should be posterior
.
for detection in detections: | |
move_meas_likelihood.append(measurement_model.logpdf(detection, moved_particles)) | |
post_meas_likelihood.append(measurement_model.logpdf(detection, moved_particles)) | |
for detection in detections: | |
move_meas_likelihood.append(measurement_model.logpdf(detection, moved_particles)) | |
post_meas_likelihood.append(measurement_model.logpdf(detection, posterior)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amended in latest commit
stonesoup/regulariser/particle.py
Outdated
alpha = (move_meas_likelihood[max_likelihood_idx]*move_likelihood) / \ | ||
(post_meas_likelihood[max_likelihood_idx]*post_likelihood) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move_likelihood
and post_likelihood
are from pdf
, and move_meas_likelihood
and post_meas_likelihood
are using logpdf
. Is this right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, there is a mismatch between logpdf
and pdf
. I have changed the move_likelihood
and post_likelihood
to also be logpdf
and changed the calculation of alpha
accordingly.
remove copies Co-authored-by: Steven Hiscocks <sdhiscocks@dstl.gov.uk>
Co-authored-by: Steven Hiscocks <sdhiscocks@dstl.gov.uk>
Created the regulariser object for optional use with particle filters when impoverishment is a problem. This has included the class MCMCRegulariser that follows a particular implementation using the Metropolis-Hastings algorithm (referenced appropriately in the docs).