elbamos/largeVis

Implement hook for custom distance methods?

Closed this issue · 1 comments

Hi,

from what I can read in the code, implementing a new distance metric for use in searchTrees is only a matter of

  1. providing a DenseAnnoySearch implementation
  2. providing a corresponding distance function.

(This at least if I do not care about working with sparse matrices. I would have to study sparse matrices better to understand that.)

I have an application where I need a custom, very specific distance metric that I can implement in (R)C(++). I can imagine others also could use this. I could just tack on the functionality, copy/paste some of the code and provide a new searchTreesMyDistance() function but it would be nicer to use a more generalizable way to plug in custom distance functions. Would you consider this?

E.g. with a
map<std::string&, distancetype (*)(arma::vec&, arma::vec&)>
type construct to register distance types?