{
  "id": "umap",
  "title": "Uniform Manifold Approximation and Projection",
  "lang": "en",
  "source_lang": "en",
  "summary": "UMAP is a nonlinear dimensionality-reduction method that builds a weighted neighborhood graph and optimizes a lower-dimensional representation, commonly for visualizing high-dimensional data.",
  "category": "computer-science",
  "subcategory": "artificial-intelligence",
  "type": "concept",
  "aliases": [
    "UMAP",
    "Uniform Manifold Approximation and Projection for Dimension Reduction"
  ],
  "generated_at": "2026-11-03",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/umap/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/umap/",
      "json": "https://aiwiki.page/zh/umap.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "Uniform Manifold Approximation and Projection (UMAP) is a nonlinear dimensionality-reduction method used to represent high-dimensional observations in a lower-dimensional space. It constructs a weighted graph describing neighborhood relationships in the original data, then finds coordinates whose corresponding relationships approximate that graph. UMAP is widely used for data visualization, especially two-dimensional plots, but it can also produce higher-dimensional representations for subsequent analysis. It belongs to manifold learning and is ordinarily used as an unsupervised learning method, although supervised and parametric variants exist."
    },
    {
      "heading": "Background and theoretical basis",
      "text": "UMAP was introduced in a 2018 paper by Leland McInnes, John Healy, and James Melville. Its theoretical motivation draws on geometry and topology, particularly the idea that data occupying a high-dimensional ambient space may lie near a manifold with substantially fewer intrinsic dimensions.\n\nA manifold is a space that locally resembles a Euclidean space, even if its overall shape is curved or complicated. For example, points on a curved surface may require three coordinates to describe their positions in the surrounding space but only two coordinates to describe movement along the surface. In practical data analysis, the manifold assumption is a modeling hypothesis rather than an established property of every dataset.\n\nUMAP's mathematical development uses fuzzy simplicial sets, which describe relationships with graded membership strengths. Its main computational procedure operates on their graph-level representation: observations become vertices, and weighted edges encode local relationships.\n\nThe word uniform refers to a theoretical treatment in which local distance scales are adjusted to accommodate the sampling of an underlying manifold. It does not mean that UMAP produces uniformly distributed points, preserves sampling density, or requires the raw observations to have a uniform distribution."
    },
    {
      "heading": "How the algorithm works",
      "text": "Let the observations be \\(x_1,\\ldots,x_n\\), with a chosen dissimilarity measure \\(d\\). UMAP seeks low-dimensional coordinates \\(y_1,\\ldots,y_n\\), typically in two or three dimensions for visualization.\n\nConstructing local neighborhoods\n\nUMAP first finds a specified number of neighbors for each observation, using exact or approximate nearest-neighbor search. This neighborhood construction is related to the search operation used in the k-nearest neighbors algorithm, although UMAP is not itself a nearest-neighbor classifier.\n\nThe distance measure is part of the model. Euclidean distance is common for continuous measurements, while cosine distance is often used for directional representations such as text embeddings. Other metrics and, in appropriate implementations, precomputed distances can also be used.\n\nFor a directed relationship from observation \\(i\\) to a neighbor \\(j\\), a standard membership weight has the form\n\n\\[w_{j\\mid i} = \\exp\\left( -\\frac{\\max(0,d(x_i,x_j)-\\rho_i)}{\\sigma_i} \\right).\\]\n\nHere:\n\n- \\(\\rho_i\\) is a local distance offset that supports a specified degree of local connectivity;\n- \\(\\sigma_i\\) is an observation-specific distance scale;\n- the scales are selected so that neighborhoods have comparable effective membership mass.\n\nThis local rescaling allows neighborhoods in densely and sparsely sampled regions to be represented on more comparable terms. It also means that membership weights are not simply transformed raw distances with one global scale.\n\nCombining neighborhoods into a graph\n\nThe directed memberships are ordinarily combined using a fuzzy union:\n\n\\[w_{ij} = w_{j\\mid i}+w_{i\\mid j} -w_{j\\mid i}w_{i\\mid j}.\\]\n\nThe resulting graph is undirected and weighted. An edge can be strong when either endpoint regards the other as a close neighbor. Implementations can modify the balance between union-like and intersection-like combinations.\n\nThis graph is the principal object that the embedding attempts to represent. Relationships omitted during neighborhood construction cannot generally be recovered merely by increasing the accuracy of the later optimization.\n\nDefining relationships in the embedding\n\nIn the low-dimensional space, UMAP uses a smooth relationship function of the form\n\n\\[q_{ij} = \\frac{1}{1+a\\lVert y_i-y_j\\rVert^{2b}},\\]\n\nwhere \\(a\\) and \\(b\\) control the shape of the distance-to-membership curve. They are commonly determined from parameters controlling the desired spacing of embedded points.\n\nA conceptual loss function compares the high-dimensional memberships \\(w_{ij}\\) with the low-dimensional memberships \\(q_{ij}\\) through fuzzy-set cross-entropy:\n\n\\[\\mathcal{L} = \\sum_{i<j} \\left[ w_{ij}\\log\\frac{w_{ij}}{q_{ij}} + (1-w_{ij}) \\log\\frac{1-w_{ij}}{1-q_{ij}} \\right].\\]\n\nTerms with zero membership are interpreted by continuity. Terms depending only on \\(w_{ij}\\) do not affect the optimized coordinates.\n\nThe first component encourages strongly connected observations to remain close; the second discourages unrelated observations from collapsing together. This is not an objective that directly minimizes errors in all original pairwise distances.\n\nOptimizing the coordinates\n\nEvaluating every pair of observations would be expensive. Practical UMAP implementations therefore use stochastic updates, sample attractive interactions from graph edges, and use negative sampling to approximate repulsive interactions. These procedures make the effective optimization behavior dependent on sampling schedules and implementation details, not only on the full conceptual cross-entropy expression.\n\nInitialization is often based on a spectral representation of the graph, although random and other initializations are available. The optimization is nonconvex, so different initial coordinates, random seeds, and numerical execution paths can produce different layouts."
    },
    {
      "heading": "Important parameters and preprocessing",
      "text": "Several hyperparameters substantially affect the result.\n\nParameter | Main effect\nn_neighbors | Sets the neighborhood size used to construct the graph. Smaller values emphasize fine local structure; larger values incorporate broader relationships.\nmin_dist | Influences how tightly neighboring observations may pack in the embedding. Smaller values generally allow more compact groups.\nn_components | Specifies the number of output dimensions; UMAP is not restricted to visualization dimensions.\nmetric | Defines the input-space dissimilarity used to construct neighborhoods.\nspread | Controls the characteristic scale of the embedded configuration in conjunction with min_dist.\nrandom_state | Controls sources of randomness where supported, helping make runs reproducible.\n\nmin_dist is not a strict geometric constraint requiring every pair of output points to remain at least that distance apart. It helps define the low-dimensional membership curve.\n\nInput representation is equally important. Feature scaling can change which observations count as neighbors when features have different units or numerical ranges. Irrelevant features, measurement noise, duplicate observations, and batch effects can all change the graph and therefore the visualization.\n\nFor very high-dimensional data, principal component analysis or another preprocessing method is sometimes used before UMAP. Such preprocessing can reduce noise and computational cost, but it also changes the information available to the neighborhood construction."
    },
    {
      "heading": "Uses and extensions",
      "text": "Exploratory visualization\n\nUMAP is used to explore image representations, document and word embeddings, scientific measurements, and other high-dimensional datasets. In single-cell research, it is commonly applied to processed gene-expression measurements to display relationships among cells.\n\nA plot may expose candidate groupings, gradients, outliers, or technical artifacts. These are features for further investigation rather than conclusions established by the layout itself.\n\nRepresentations for downstream analysis\n\nUMAP can create representations with more than two dimensions for tasks such as search, clustering, and anomaly detection. Its usefulness depends on whether the neighborhood relationships it retains are appropriate for the downstream task.\n\nClustering a two-dimensional visualization can give different results from clustering the original features or a higher-dimensional representation. A visually clean map is not, by itself, evidence of a better analytical representation.\n\nTransforming new observations\n\nA fitted UMAP model can generally place new observations into an existing embedding by identifying their relationships to the fitted data and optimizing their positions relative to that embedding. This differs from refitting the entire model on the combined dataset.\n\nThe standard method does not learn a single explicit global projection formula in the way PCA does. Its transformation behavior is tied to the fitted reference data and may be unreliable for observations far outside that reference distribution.\n\nSupervised and parametric variants\n\nSupervised UMAP incorporates target information into the construction of relationships. Depending on the implementation and settings, both categorical labels and continuous targets can influence the result; partially labeled data can support semi-supervised learning.\n\nBecause labels help shape such a map, visible separation of those labels is not independent evidence that they are naturally separated in the original data.\n\nParametric UMAP trains an artificial neural network to map inputs to embedding coordinates using a UMAP-related objective. It provides an explicit learned mapping and can support rapid embedding of new observations, while introducing neural-network architecture and training choices.\n\ndensMAP extends UMAP with a density-related objective intended to preserve more information about local density. Ordinary UMAP does not reliably preserve this information."
    },
    {
      "heading": "Comparison with other methods",
      "text": "PCA is a linear method that identifies directions of greatest variance. It has a direct global transformation and a well-defined relationship to linear reconstruction error. UMAP can represent nonlinear neighborhood structure that PCA may not expose, but its coordinates do not provide an analogous explained-variance interpretation.\n\nt-distributed stochastic neighbor embedding (t-SNE) is another widely used nonlinear visualization method. Both methods emphasize neighborhood relationships and can display separated groups whose distances and sizes do not directly reproduce those in the input space. Their graph or probability constructions, low-dimensional similarity functions, and optimization procedures differ. Claims that one universally preserves global structure better or always runs faster depend on the dataset, settings, implementation, and evaluation criterion.\n\nUMAP is not a clustering algorithm. It produces coordinates, not cluster assignments. Apparent clusters can be influenced by the embedding objective and parameters as well as by structure in the observations."
    },
    {
      "heading": "Limitations and interpretation",
      "text": "Local structure does not determine a faithful global map\n\nUMAP principally models neighborhood relationships. Distances between widely separated groups, their relative orientations, and the sizes of empty spaces between them generally lack a direct quantitative interpretation. Entire layouts may be rotated or reflected without changing their meaningful neighborhood structure.\n\nDisconnected or weakly connected components are particularly difficult to position meaningfully relative to one another because the graph provides little information about their relative arrangement.\n\nApparent separation and density can be misleading\n\nUMAP can emphasize gaps, compress continuous variation, and create visually distinct regions. Compact groups need not have equal variability or equal density in the original space. A group's area on the plot is not a reliable measure of its population size or original dispersion.\n\nLabels, trajectories, and scientific interpretations therefore require evidence beyond visual appearance. Quantitative evaluations can examine retained neighborhoods and complementary measures of distortion rather than relying solely on the plot.\n\nResults depend on modeling and computational choices\n\nThe distance metric, preprocessing, neighborhood size, initialization, and random sampling all influence the result. Reproducibility may also depend on software versions and parallel execution, since concurrent updates can change numerical behavior.\n\nApproximate neighbor search and sparse graph optimization make UMAP practical for many large datasets, but there is no universal near-linear runtime guarantee. High input dimension, difficult distance metrics, large neighborhoods, and unfavorable neighbor-search behavior can substantially increase time and memory requirements.\n\nEvaluation must distinguish exploration from prediction\n\nWhen UMAP is part of a predictive pipeline, fitting it before separating training and evaluation observations can introduce data leakage, even without using target labels: the held-out observations have influenced the fitted representation. Supervised UMAP introduces an additional route for label information to enter the embedding.\n\nFor evaluation of predictive generalization, the embedding fit belongs within the training procedure, and held-out observations must be handled through the corresponding transformation process. When all observations are deliberately embedded for a descriptive visualization, the analysis instead concerns that joint dataset and does not by itself measure out-of-sample predictive performance."
    }
  ],
  "links": [
    "dimensionality-reduction",
    "data-visualization",
    "manifold-learning",
    "unsupervised-learning",
    "topology",
    "k-nearest-neighbors-algorithm",
    "loss-function",
    "hyperparameter",
    "feature-scaling",
    "principal-component-analysis",
    "word-embedding",
    "gene-expression",
    "anomaly-detection",
    "semi-supervised-learning",
    "artificial-neural-network",
    "t-sne",
    "parallel-computing",
    "data-leakage",
    "generalization"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}