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
385 stars 127 forks source link

Create sampler module and gaussian mixture sampling function #793

Closed timothy-glover closed 1 year ago

timothy-glover commented 1 year ago

Introduced the sampler module for producing samples from distributions. ParticleSampler is the main class contributed for this and it accepts a callable sampling function such as numpy.random.multivariate_normal or scipy.stats.uniform.rvs, and a dictionary of parameters to be used as kwargs for the callable and returns a ParticleState containing the samples. GaussianDetectionParticleSampler is a child class of ParticleSampler that specifically samples from Detection or sets of Detection. DetectionSampler is a general Detection sampler that is able to switch between a detection based sampler object such as GaussianDetectionParticleSampler and a non-detection backup sampler such as ParticleSampler that is used if no detections are available.

No single callable has been found for sampling from Gaussian mixture distributions which lead to the introduction of gm_sample method in stonesoup.functions. This method can be used as a callable for ParticleSampler and is the sampler used by GaussianDetectionParticleSampler.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 97.12% and project coverage change: +0.02 :tada:

Comparison is base (78c88a4) 94.90% compared to head (61bed83) 94.92%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #793 +/- ## ========================================== + Coverage 94.90% 94.92% +0.02% ========================================== Files 176 183 +7 Lines 9757 9919 +162 Branches 1938 1970 +32 ========================================== + Hits 9260 9416 +156 - Misses 353 355 +2 - Partials 144 148 +4 ``` | Flag | Coverage Δ | | |---|---|---| | integration | `67.87% <47.84%> (-0.42%)` | :arrow_down: | | unittests | `90.03% <97.12%> (+0.10%)` | :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. | [Impacted Files](https://app.codecov.io/gh/dstl/Stone-Soup/pull/793?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl) | Coverage Δ | | |---|---|---| | [stonesoup/types/state.py](https://app.codecov.io/gh/dstl/Stone-Soup/pull/793?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl#diff-c3RvbmVzb3VwL3R5cGVzL3N0YXRlLnB5) | `98.53% <89.09%> (-1.25%)` | :arrow_down: | | [stonesoup/functions/\_\_init\_\_.py](https://app.codecov.io/gh/dstl/Stone-Soup/pull/793?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl#diff-c3RvbmVzb3VwL2Z1bmN0aW9ucy9fX2luaXRfXy5weQ==) | `94.40% <100.00%> (+0.53%)` | :arrow_up: | | [stonesoup/models/measurement/nonlinear.py](https://app.codecov.io/gh/dstl/Stone-Soup/pull/793?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl#diff-c3RvbmVzb3VwL21vZGVscy9tZWFzdXJlbWVudC9ub25saW5lYXIucHk=) | `99.05% <100.00%> (-0.01%)` | :arrow_down: | | [stonesoup/predictor/particle.py](https://app.codecov.io/gh/dstl/Stone-Soup/pull/793?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl#diff-c3RvbmVzb3VwL3ByZWRpY3Rvci9wYXJ0aWNsZS5weQ==) | `92.95% <100.00%> (ø)` | | | [stonesoup/regulariser/\_\_init\_\_.py](https://app.codecov.io/gh/dstl/Stone-Soup/pull/793?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl#diff-c3RvbmVzb3VwL3JlZ3VsYXJpc2VyL19faW5pdF9fLnB5) | `100.00% <100.00%> (ø)` | | | [stonesoup/regulariser/base.py](https://app.codecov.io/gh/dstl/Stone-Soup/pull/793?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl#diff-c3RvbmVzb3VwL3JlZ3VsYXJpc2VyL2Jhc2UucHk=) | `100.00% <100.00%> (ø)` | | | [stonesoup/regulariser/particle.py](https://app.codecov.io/gh/dstl/Stone-Soup/pull/793?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl#diff-c3RvbmVzb3VwL3JlZ3VsYXJpc2VyL3BhcnRpY2xlLnB5) | `100.00% <100.00%> (ø)` | | | [stonesoup/resampler/particle.py](https://app.codecov.io/gh/dstl/Stone-Soup/pull/793?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl#diff-c3RvbmVzb3VwL3Jlc2FtcGxlci9wYXJ0aWNsZS5weQ==) | `100.00% <100.00%> (ø)` | | | [stonesoup/sampler/\_\_init\_\_.py](https://app.codecov.io/gh/dstl/Stone-Soup/pull/793?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl#diff-c3RvbmVzb3VwL3NhbXBsZXIvX19pbml0X18ucHk=) | `100.00% <100.00%> (ø)` | | | [stonesoup/sampler/base.py](https://app.codecov.io/gh/dstl/Stone-Soup/pull/793?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl#diff-c3RvbmVzb3VwL3NhbXBsZXIvYmFzZS5weQ==) | `100.00% <100.00%> (ø)` | | | ... and [3 more](https://app.codecov.io/gh/dstl/Stone-Soup/pull/793?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dstl) | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.