You can edit almost every page by Creating an account and confirming your email.

Uniform Manifold Approximation and Projection for Dimension Reduction

From EverybodyWiki Bios & Wiki


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 N, in fact, lie on a d-manifold embedded into N. In particular, even if the dimension of the ambient space N 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 X={x1,...,xn}N which lies on a Riemannian-d-manifold (,g) embedded into N.[1] While the embedding N must be continuous, it need not be an isometry with respect to the Euclidean metric. Crucially, it is assumed that x1,...,xnN have been sampled from the uniform distribution with respect to the volume form associated with the (possibly unknown) Riemannian metric g.[1]

The UMAP algorithm first infers g 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 m, where mN is user-defined. The projection to low-dimensional space is optimised such that it minimises the difference between the Euclidean metric and g. As the points x1,...,xn 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 (,g) 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 (,g).

Algorithm

Construction of Neighbourhood Graph

The UMAP algorithm itself uses a k-nearest-neighbour graph (k-nn graph) on a finite pseudo-metric space (X,d), which is a special case of a fuzzy-simplicial set. Let the k-nn graph G have vertices X and directed edges E. For fixed xX, define ρx=min{d(x,x)|(x,x)E,d(x,x)>0} and σx>0 such that (x,x)Eexp(max{0,d(x,x)ρx}σx)=log2(k).

Each edge is then weighted by exp(max{0,d(x,x)ρx}/σx), resulting in a weighted adjacency matrix A. The x,x-entry of A can then be interpreted as the probability of a directed edge from x to x existing. The directed, weighted graph is then turned into an undirected, weighted graph by setting its adjacency matrix to be B=A+ATAAT, where denotes the Hadamard product (i.e. element-wise multiplication). The weight of an undirected edge in B between x and x can then be interpreted as the edge existing in at least one direction in the graph determined by A.

Optimisation Algorithm

The neighbourhood graph G is then embedded into low-dimensional Euclidean space m, i.e. each xiX is mapped to a yiYm. By using stochastic gradient descent, UMAP optimises an embedding such that the weights of a neighbourhood graph constructed in the Euclidean norm in m (by the same principles as above) are similar to the one constructed in high-dimensional space. As the sample X is assumed to be uniform in the Riemannian metric g and the embedding is aimed to be (near-)isometric, the parameters ρ and σ are assumed to be identical for all yY. In particular, UMAP treats ρ as a hyper-parameter, called min_dist, and sets σ=1.

A caveat to performing this optimisation directly by using stochastic gradient descent is that the function Ψ:m×m[0,1] given by Ψ(yi,yj)=exp(max{0,yiyjmin_dist}) is not differentiable due to the use of the max-condition. UMAP approximates Ψ by the function Φ:m×m[0,1] given by Ψ(yi,yj)=(1+ayiyj2b)1, where a and b 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 * (log(Φ))(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 * (log(1Φ))(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 k-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. 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].
  2. 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)
  3. Spivak, David I. "Metric Realization of Fuzzy Simplicial Sets" (PDF). Retrieved 2022-10-04.
  4. Belkin, Mikhail; Niyogi, Partha (2001). "Laplacian Eigenmaps and Spectral Techniques for Embedding and Clustering". Advances in Neural Information Processing Systems. MIT Press. 14.
  5. "UMAP Reproducibility — umap 0.5 documentation". umap-learn.readthedocs.io. Retrieved 2022-10-04.
  6. "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.