dstl / Stone-Soup

A software project to provide the target tracking community with a framework for the development and testing of tracking algorithms.
https://stonesoup.rtfd.io
MIT License
384 stars 126 forks source link

Update UncertaintyRewardFunction to return tracks and minor modifications #1048

Closed timothy-glover closed 1 week ago

timothy-glover commented 1 week ago

This PR introduces several minor updates, mainly to the UncertaintyRewardFunction. The first change is to add return_tracks as a property to the UncertaintyRewardFunction allowing it to be used with the MCTS type sensor managers and any other sensor management algorithm that requires storage and reuse of states estimated during reward calculation. A test has also been added to verify this functionality with MCTS.

The second change to UncertaintyRewardFunction is in generating detections from predicted future target states. As the measure method of a sensor is not designed to operate on particle states, it will return a measurement for every state_vector in state_vectors of the ParticleState which is not handled by a ParticleUpdater under usual circumstances. To prevent this problem, the mean of predicted_track objects are used to construct a GroundTruthState which is passed into the measure method. This generates a single measurement from the ParticleState objects and has no effect when dealing with GaussianState types. GroundTruthState also allows for track metadata to be stored in the object.

The third chance is to add a property to the UncertaintyRewardFunction has also been added, measurement_noise, which allows the user to decide whether noise should be added when generating predicted future measurements. This defaults to False, as it was before this change.

For ExpectedKLDivergence and MultiUpdateKLDivergence, as these classes were constructing a State object when generating measurements, this has been updated to the GroundTruthState inline with the UncertaintyRewardFunction to allow for metadata passing. The measurement_noise property has also been added to these classes.

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.

Project coverage is 93.95%. Comparing base (f67aead) to head (2e262df).

Files Patch % Lines
stonesoup/sensormanager/reward.py 81.81% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1048 +/- ## ========================================== + Coverage 93.90% 93.95% +0.04% ========================================== Files 204 204 Lines 13345 13351 +6 Branches 2730 2731 +1 ========================================== + Hits 12532 12544 +12 + Misses 551 547 -4 + Partials 262 260 -2 ``` | [Flag](https://app.codecov.io/gh/dstl/Stone-Soup/pull/1048/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl) | Coverage Δ | | |---|---|---| | [integration](https://app.codecov.io/gh/dstl/Stone-Soup/pull/1048/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl) | `67.29% <81.81%> (+0.05%)` | :arrow_up: | | [unittests](https://app.codecov.io/gh/dstl/Stone-Soup/pull/1048/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl) | `88.57% <63.63%> (+0.02%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.