Add general interface to calculate pairwise distances
msluszniak opened this issue · comments
As mentioned in #172 we may easily create a general interface for pairwise distance calculations.
@josevalim I'm wondering which direction we should choose. One way is to have one general function like pairwise_distance
which accepts an atom with the name of a distance and the rest of the opts. Another way is to have a separate function for each distance.
Can you send a PR with two different distances implemented (or a code comment) so we can discuss which approach may work better with code? :)
Okay, that sounds good
Sorry, but I was wrong. There is no general formulation to calculate all pairwise distances for all metrics. From the functions that are available in Scholar
, only euclidean
, squared_euclidean
, and cosine
can be evaluated faster than simply broadcasting tensors and then using our implemented functions. Because of that, I think that implementing only those three is not worth the effort.
Should we have pairwise_euclidean/pairwise_cosine or not worth it? Does scikit-learn provide anything like this?
Yes, scikit-learn provides both of them and more. Maybe it's worth having them, but definitely not in the formula I proposed, but as a part of Scholar.Metrics.Distnaces
:)
Sounds good to me then! :)