we should disconnect points beyond a certain distance
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.3k
- Forks
- 871
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 5
Description
So it seems that the UMAP assumption that our manifold is connected has a small problem when confronted with some interesting class of real world data. It is particularly noticeable when dealing with bounded distances such as Jaccard, Hellinger, etc...
In those distance measures you can (and do) get points what have no features in common with any other point and thus have a maximal distance of 1 to every other point. We will calculate their k-nearest neighbours (a random selection of k equidistant points) and then apply the UMAP kernel to induce a similarity over those edges. Because each of those points are equidistant (dist=1) they will all be called maximally similar. Too many of these points will pull together random sets of points and distort the manifold you are trying to learn.
An easy solution to this would be to add a new parameter disconnection_distance to our UMAP model which prunes edges greater than that distance from our knn graph before applying the UMAP kernel. This may trim some edges from some points and fully disconnect other points from our manifold entirely. I'll add a variable severity warning depending on what proportion of your vertices are fully disconnected. I propose having a dictionary of bounded metrics (DISCONNECTION_DISTANCES) which defaults our disconnection_distance to the maximal value for our bounded distance measures. Otherwise it should default to np.inf (anything that a distance function declares as np.inf apart from something else should never be connected to it. As we support new bounded metrics we should go through and add them to this dictionary.
This will result in disconnected vertices being embedded via the spectral intitalization (or random initialization) then slowly getting pushed away from all other points.
I'll add a umap.util.disconnected_vertices(model) function as well for easy post modeling access to which vertices were disconnected. That should let people easily either filter them and re-run UMAP or just filter them out in the plotting via the subset_points functionality.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the UMAP model's k-nearest-neighbour graph construction and the proposed DISCONNECTION_DISTANCES and disconnection_distance parameters. Check how disconnected vertices would affect spectral or random initialization, then define the warning and umap.util.disconnected_vertices(model) behavior; done means bounded-distance edges are pruned without changing existing unbounded metrics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100