umap-js icon indicating copy to clipboard operation
umap-js copied to clipboard

Feature Request: Accept custom distance function based on labels

Open krrishh-org opened this issue 2 years ago • 2 comments

I have a distance matrix precalculated for each pair of labels, and I would like to pass that distance instead of eucliden or some other method.

It will e helpful if the distanceFn accepts a function that takes two labels as arguments and return the distance.

krrishh-org avatar Apr 13 '22 11:04 krrishh-org

You can already do this. See this example: https://observablehq.com/@fil/umap-simple-topologies

zdk123 avatar May 12 '22 17:05 zdk123

Hi @zdk123,

Thank you for this. But I needed the distanceFn to be invoked using the labels instead of indices for supervised projection. I created a workaround in my local by mapping labels to indices.

krrishh-org avatar May 13 '22 05:05 krrishh-org