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

supertypes of minkowski and mahalanobis do not match most other classes #245

Open
CMGreenspon opened this issue Nov 4, 2022 · 1 comment

Comments

@CMGreenspon
Copy link

CMGreenspon commented Nov 4, 2022

julia> supertypes(typeof(euclidean))
(Euclidean, Distances.UnionMetric, Metric, SemiMetric, PreMetric, Any)

julia> supertypes(typeof(minkowski))
(typeof(minkowski), Function, Any)

julia> supertypes(typeof(mahalanobis))
(typeof(mahalanobis), Function, Any)

Easy to get around this when trying to quickly switch between distance metrics but it seems like odd behavior

@richardreeve
Copy link
Contributor

I think the fact that most of the shorthand distance functions (like euclidean()) give supertypes at all is a "feature" of how the functions are defined here:

@eval @inline (dist::$M)(a, b) = _evaluate(dist, a, b, parameters(dist))

The actual type hierarchy can be derived from the types themselves, which are capitalised as Euclidean, Mahalanobis and Minkowski, etc:

julia> supertypes(Euclidean)
(Euclidean, Distances.UnionMetric, Metric, SemiMetric, PreMetric, Any)

julia> supertypes(Mahalanobis)
(Mahalanobis, Metric, SemiMetric, PreMetric, Any)

julia> supertypes(Minkowski)
(Minkowski, Distances.UnionMetric, Metric, SemiMetric, PreMetric, Any)

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