Uniform Manifold Approximation and Projection for Dimension Reduction
Uniform Manifold Approximation and Projection for Dimension Reduction
Uniform Manifold Approximation and Projection for Dimension Reduction (UMAP) is a non-linear dimensionality reduction method developed by Leland McInnes, John Healy and James Melville.[1] Since its publication in 2018, it has become a widely used method for dimensionality reduction and visualisation of high-dimensional data across numerous fields of research.[2] UMAP is a manifold-learning algorithm that employs insights from category theory and topological data analysis[1]
Manifold Hypothesis & Intuition
Like other manifold-learning methods, UMAP uses the hypothesis that most real-world data sets sampled from some n-dimensional Euclidean space , in fact, lie on a d-manifold embedded into . In particular, even if the dimension of the ambient space is large, the dimension of the manifold will typically be small.[1] UMAP endeavours to find such a manifold that approximates a given sample well and embed it into a low-dimensional Euclidean space.
Formally, UMAP assumes we are given a sample which lies on a Riemannian-d-manifold embedded into .[1] While the embedding must be continuous, it need not be an isometry with respect to the Euclidean metric. Crucially, it is assumed that have been sampled from the uniform distribution with respect to the volume form associated with the (possibly unknown) Riemannian metric .[1]
The UMAP algorithm first infers and then approximates at changing resolutions using a sequence of simplicial sets. The algorithm projects the sequence of simplicial approximations into a low-dimensional Euclidean space , where is user-defined. The projection to low-dimensional space is optimised such that it minimises the difference between the Euclidean metric and . As the points can be mapped to the vertices of the projected simplicial sets, the algorithm yields a dimensionality reduction of the high-dimensional sample.
Theoretical Foundations
McInnes et al. use so-called fuzzy simplicial sets, a notion from category theory which generalises the notion of a simplicial set, to formalise the theoretical foundations of their algorithm. Fuzzy simplicial sets are related to filtrations of a simplicial complex,[3] a construction widely used in topological data analysis and persistent homology. Both a simplicial set and a simplicial complex can be viewed as combinatorial descriptions of a manifold. McInnes et al. describe the operations of building a simplicial approximation of a Riemannian manifold from a finite sample and embedding the vertices of a fuzzy simplicial set in a metric space as two functors. By proving that their two functors are adjoint, they show that their proposed embedding gives an optimal reconstruction of the metric structure of .
Algorithm
Construction of Neighbourhood Graph
The UMAP algorithm itself uses a -nearest-neighbour graph (-nn graph) on a finite pseudo-metric space , which is a special case of a fuzzy-simplicial set. Let the -nn graph have vertices and directed edges . For fixed , define and such that
Each edge is then weighted by , resulting in a weighted adjacency matrix . The -entry of can then be interpreted as the probability of a directed edge from to existing. The directed, weighted graph is then turned into an undirected, weighted graph by setting its adjacency matrix to be where denotes the Hadamard product (i.e. element-wise multiplication). The weight of an undirected edge in between and can then be interpreted as the edge existing in at least one direction in the graph determined by .
Optimisation Algorithm
The neighbourhood graph is then embedded into low-dimensional Euclidean space , i.e. each is mapped to a . By using stochastic gradient descent, UMAP optimises an embedding such that the weights of a neighbourhood graph constructed in the Euclidean norm in (by the same principles as above) are similar to the one constructed in high-dimensional space. As the sample is assumed to be uniform in the Riemannian metric and the embedding is aimed to be (near-)isometric, the parameters and are assumed to be identical for all . In particular, UMAP treats as a hyper-parameter, called min_dist, and sets .
A caveat to performing this optimisation directly by using stochastic gradient descent is that the function given by is not differentiable due to the use of the -condition. UMAP approximates by the function given by , where and are obtained by a least-square fit against . Unlike , the function is differentiable and, therefore, has a well-defined gradient.
The stochastic gradient descent is then performed against and uses a spectral embedding[4] as initialisation. The UMAP algorithm can thus be summarised as follows:
1 function UMAP(X, k, m, min_dist, n_epochs, n_neg_samples): 2 3 graph = knn_graph(X, k) # undirected knn graph weighted as above 4 y = spectral_embedding(graph, m) 5 fit from min_dist 6 alpha = 1.0 7 8 for e = 1,...,n_epochs: 9 for all ([i,j], p) in graph.edges: 10 if random() <= p: # optimise the position of sample y_i with probability p 11 y[i] = y[i] + alpha * (y[i], y[j]) # apply the attracting force of y_j to the position of y_i 12 for s = 1,...,n_neg_samples: 13 l = random_int(X.size()) # Pick any sample at random. It is most likely NOT a neighbour of y_i 14 y[i] = y[i] + alpha * (y[i], y[l]) # apply the repelling force of y_l to the position of y_i 15 16 alpha = 1.0 - e / n_epochs 17 18 return y
Software
The authors of UMAP implemented the UMAP algorithm in a Python package called umap-learn, which provides a class compatible with the scikit-learn machine learning package. It should be noted that umap-learn uses an approximate, randomised -nn graph via the pynn-descent[5] package. Some of the default parameter values in umap-learn include min_dist=0.1 and n_neg_samples=5.[6]
The R package umap provides two implementations of the UMAP algorithm: one that has been implemented from scratch and one that calls the umap-learn Python package via an interface.
MATLAB provides an implementation in a package called Uniform Manifold Approximation and Projection (UMAP), which follows the Python implementation in umap-learn closely.
Further implementations are provided in Julia (UMAP.jl) and Java (umap-java), each being native implementations in the respective language.
References
- ↑ 1.0 1.1 1.2 1.3 1.4 McInnes, Leland; Healy, John; Melville, James (2020-09-17). "UMAP: Uniform Manifold Approximation and Projection for Dimension Reduction". arXiv:1802.03426 [stat.ML].
- ↑ Diaz-Papkovich, Alex; Anderson-Trocmé, Luke; Gravel, Simon (January 2021). "A review of UMAP in population genetics". Journal of Human Genetics. 66 (1): 85–91. doi:10.1038/s10038-020-00851-4. ISSN 1435-232X. PMC 7728596 Check
|pmc=value (help). PMID 33057159 Check|pmid=value (help). Unknown parameter|s2cid=ignored (help) - ↑ Spivak, David I. "Metric Realization of Fuzzy Simplicial Sets" (PDF). Retrieved 2022-10-04.
- ↑ Belkin, Mikhail; Niyogi, Partha (2001). "Laplacian Eigenmaps and Spectral Techniques for Embedding and Clustering". Advances in Neural Information Processing Systems. MIT Press. 14.
- ↑ "UMAP Reproducibility — umap 0.5 documentation". umap-learn.readthedocs.io. Retrieved 2022-10-04.
- ↑ "UMAP API Guide — umap 0.5 documentation". umap-learn.readthedocs.io. Retrieved 2022-10-04.
This article "Uniform Manifold Approximation and Projection for Dimension Reduction" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Uniform Manifold Approximation and Projection for Dimension Reduction. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.
