-
Notifications
You must be signed in to change notification settings - Fork 18
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
Levenshtein Distance is a true Metric, not a SemiMetric #19
Comments
The more minimal version of this is to just change |
That's interesting. I'm not sure what to do. The issue is that |
Removing the abtract type This package introduces distance modifiers This suggests that properties of the metric should a trait rather than an abstract type. I'm curious what other people think (e.g. @KristofferC) |
The Distances.jl has some very strange stuff like https://github.com/JuliaStats/Distances.jl/blob/7f3a28c0d1372e3b3edbcbc28f00ba5645e1bbdb/src/metrics.jl#L107-L108 which makes it hard to understand how types are structured... Regarding using a trait, it might make sense. The comment about "Partial{Levenshtein} is a true metric whereas Partial{Jaro} is only a semimetric" suggests it would be a good idea since subtyping cannot model that. |
Removing My gut is telling me that most of those parameterized distence modifies are not true |
Inheritance from StringDistances is useful for me. Maybe ask the NearestNeighbour package to allow premetric — they can always print a warning in this case. |
I've removed the inheritance from |
thanks, think that is a good solution, and if it becomes unworkable then traits become next inline |
It statisfies the triangle inequality.
Here's a nice blog post on that fact.
But in the package we have subtyping
StringDistance
which subtypesSemiMetric
.Getting this wrong is a problem because, various kinds of neighbours trees (NearestNeighbours.jl) require a true
Metric
to work.I suggest that we
@deprecate_binding StringDistance SemiMetric
and just use the right type from Distances.jl for each thing directly.
The fact that a particular metric is a StringDistance does not particularly matter.
The text was updated successfully, but these errors were encountered: