Stone-Soup icon indicating copy to clipboard operation
Stone-Soup copied to clipboard

Add multi-distance hypothesiser

Open oharrald-Dstl opened this issue 3 years ago • 2 comments

The standard DistanceHypothesiser only allows a fixed measure to be used. If one has incoming detections of BearingRange type, and some of Cartesian type, clearly the distance should be calculated differently. The usual way around the issue would be to use a Mahalanobis measure and entirely avoid the units of measurement in the measurement space. This PR adds a hypothesiser that allows the user to have multiple "distance" measures available, dependent on what the incoming detections' measurement models are.

I'll leave this PR as a discussion in the instance where this PR is redundant and there are better ways to go around this problem.

oharrald-Dstl avatar Feb 08 '22 12:02 oharrald-Dstl

Codecov Report

Merging #594 (fc1d1a7) into main (ce4e4f6) will increase coverage by 0.01%. The diff coverage is 100.00%.

:exclamation: Current head fc1d1a7 differs from pull request most recent head c27e22c. Consider uploading reports for the commit c27e22c to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #594      +/-   ##
==========================================
+ Coverage   94.32%   94.34%   +0.01%     
==========================================
  Files         154      154              
  Lines        7352     7376      +24     
  Branches     1399     1405       +6     
==========================================
+ Hits         6935     6959      +24     
  Misses        314      314              
  Partials      103      103              
Flag Coverage Δ
integration 68.47% <33.33%> (-0.09%) :arrow_down:
unittests 91.70% <100.00%> (+0.02%) :arrow_up:

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

Impacted Files Coverage Δ
stonesoup/hypothesiser/distance.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ce4e4f6...c27e22c. Read the comment docs.

codecov[bot] avatar Feb 09 '22 08:02 codecov[bot]

I've replaced the separate hypothesisers and measurement_models attributes in favour of a dictionary, keyed by the measurement model types and valued with the hypothesisers. The reason behind not using particular measurement model instances is that a measurement model might be dynamic, and have its properties change over time. Therefore either an instance check or type check would be needed for correct keying.

The multi-hypothesiser now raises an error on detections without measurement models, or measurement models that have no corresponding hypothesiser in the hypothesiser_dict attribute.

oharrald-Dstl avatar Mar 10 '22 09:03 oharrald-Dstl

Closing for now, as don't have use case. Please comment if you think this will be of use.

sdhiscocks avatar Feb 21 '23 10:02 sdhiscocks