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

kl_divergence and js_divergence do not propagate NaNs #259

Closed
mauricelanghinrichs opened this issue Nov 14, 2023 · 1 comment · Fixed by #260
Closed

kl_divergence and js_divergence do not propagate NaNs #259

mauricelanghinrichs opened this issue Nov 14, 2023 · 1 comment · Fixed by #260

Comments

@mauricelanghinrichs
Copy link

I noticed the following behaviour for the distribution-based KL and JS distances. In contrast to euclidean as a reference, kl_divergence and js_divergence distances do not propagate NaNs, leading to negative distances in the examples below. I don't know if this is desired behaviour; in my opinion they should rather propagate NaNs instead.

julia> using Distances
julia> kl_divergence([NaN, 0.1], [0.5, 0.5])
-0.16094379124341004
julia> js_divergence([NaN, 0.1], [0.5, 0.5])
-0.10051100363189411
julia> euclidean([NaN, 0.1], [0.5, 0.5])
NaN
@richardreeve
Copy link
Contributor

@devmotion - #260 closes this as well as some other minor testing fixes. Could you check it and merge it if you're happy?

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

Successfully merging a pull request may close this issue.

2 participants