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

Implementation for custom distances? #10

Open
ninamiolane opened this issue Jul 9, 2020 · 3 comments
Open

Implementation for custom distances? #10

ninamiolane opened this issue Jul 9, 2020 · 3 comments

Comments

@ninamiolane
Copy link

Hi, very nice package!

Is it possible to use it with a distance correlation coming from a custom notion of distance between Xi/Xj or Yi/Yj (i.e. not necessarily an exponent of the Euclidean distance?). If not, would you know of an implementation available to do so?

Thank you!

@vnmabus
Copy link
Owner

vnmabus commented Jul 9, 2020

Currently it is not possible. It could be done, at least for the naive algorithm, propagating the distance function until the point where pairwise_distances is called, calling the distance function instead. Currently I have no time for this, but I would review a PR if someone takes the time.

You have several options:

  • Use the R package energy, from the original authors of distance correlation. They allow you to pass a precomputed distance matrix.
  • Download this package and replace pairwise_distances by your function (the ugly, one-time solution, but may work for you).
  • Take a little more time to implement a robust solution (passing a distance callable through functions that need it) and propose a PR. I will review it, and if it is ok you would have help others with the same problem.

@ninamiolane
Copy link
Author

Thank you very much for your quick answer! I saw the energy package, but I was looking for something in Python.

Thanks also for the indication on how to implement it, I'll see if I can find time and if so will submit a PR.

@vnmabus
Copy link
Owner

vnmabus commented Jul 9, 2020

Before performing any work, I advise you to research if that is a sound procedure, that is, if the good properties of distance correlation are conserved if the distance is not Euclidean. I am not aware if that is the case, and I would prefer not to offer any option that can mislead the users of the package.

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