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

Data association with Global Nearest Neighbor Filter not working as expected #824

Open
arickGrootveld opened this issue Jul 2, 2023 · 3 comments

Comments

@arickGrootveld
Copy link

I've found that using a global nearest neighbor filter as a data associator in my own code creates an unexpected effect.

Basically, the Global Nearest Neighbor associates the measurement to the first track, rather than the track with the smallest distance.

In reality, this might just be user error, but I wanted to make an issue demonstrating what I'm seeing so that I can be sure this is not a problem with Stone Soup.

See the attached files and script as a demonstration of what I mean (you may have to change the path in the script, so that it points at the pickle files correctly, depending on where you put them).
issueDemonstrationFiles.zip

@sdhiscocks
Copy link
Member

Thanks for the report @arickGrootveld.

So the issue we've identified is when there is no missed distance set in the DistanceHypothesiser, the default missed distance is then np.inf. This results in the Joint Hypotheses, which sums the combination of individual hypotheses across all tracks, having every sum containing a np.inf in the case that there are less tracks than measurements.

If you use the GNNWith2DAssignment (which we generally recommend to use, as it's much faster) it will raise that the problem is infeasible. The GlobalNearestNeighbour should really also do this, but currently it just returns the first result.

In the interim, adding a large missed distance in the DistanceHypothesier will fix this. In case of using Mahalanobis, then 100 would be fine.

We are thinking a possible fix, would be where the missed distances are all np.inf that setting them to the largest non-missed distance plus epsilon, will ensure that both GlobalNearestNeighbour and GNNWith2DAssignment function correctly in case of having no missed distance defined.

@arickGrootveld
Copy link
Author

Thank you so much for getting back to me about this @sdhiscocks. I just verified that setting the "missed_distance" parameter in the initialization of the "DistanceHypothesiser" with a large value (I used 100 as you recommended) fixes the issue entirely.

Would you or your group be interested in having an external pull request for this? It might take me a bit to familiarize myself with your code base, but I could at least give it a shot.

Thanks again for helping me with this, and let me know if you guys would be ok with me taking a shot at fixing it.

@sdhiscocks
Copy link
Member

Would you or your group be interested in having an external pull request for this? It might take me a bit to familiarize myself with your code base, but I could at least give it a shot.

Yes, that would be great. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants