# UMAP

UMAP（Uniform Manifold Approximation and Projection，均匀流形逼近与投影）是一种非线性降维方法，它将数据表示为模糊拓扑结构，并通过优化布局使其与该结构相匹配，从而将高维数据嵌入低维空间。它可用于数据可视化，也可作为聚类等机器学习任务的预处理步骤。<sup>[1](https://www.nature.com/articles/s43586-024-00363-x)</sup> 该方法由莱兰·麦金尼斯（Leland McInnes）、约翰·希利（John Healy）和詹姆斯·梅尔维尔（James Melville）于2018年提出<sup>[2](https://doi.org/10.48550/arxiv.1802.03426)</sup>，是现有最快的流形学习实现之一，且显著快于大多数t-SNE实现。<sup>[3](https://doi.org/10.21105/joss.00861)</sup> 它已成为单细胞生物学中的标准可视化工具。<sup>[4](https://doi.org/10.1038/nbt.4314)</sup>

| 关键事实 | 详情 |
|---|---|
| 输入/输出 | 一个高维数据集（稀疏或稠密，已报道的使用中超过一百万维）和一个低维嵌入<sup>[5](https://github.com/lmcinnes/umap/)</sup> |
| 原理 | 高维和低维数据的模糊单纯集表示，通过最小化交叉熵进行匹配<sup>[2](https://doi.org/10.48550/arxiv.1802.03426)</sup> |
| 默认超参数 | n_neighbors = 15，min_dist = 0.1，negative_sample_rate = 5，metric = euclidean<sup>[6](https://github.com/lmcinnes/umap/blob/master/umap/umap_.py)</sup> |
| 报道速度 | MNIST（70,000个样本，784维）在3.1 GHz Intel Core i7上42秒完成嵌入<sup>[5](https://github.com/lmcinnes/umap/)</sup> |
| GPU扩展性 | cuML 24.10在单块H100上处理5000万点×768维；多GPU cuML 25.06在8分钟内嵌入1.06亿个向量<sup>[7](https://developer.nvidia.com/blog/even-faster-and-more-scalable-umap-on-the-gpu-with-rapids-cuml/)</sup><sup> • </sup><sup>[8](https://developer.nvidia.com/blog/run-massive-scale-umap-in-minutes-using-multiple-gpus-without-losing-accuracy/)</sup> |
| 主要批评 | 负采样优化所最小化的有效损失与所声称的交叉熵不同，排斥项权重偏低<sup>[9](https://proceedings.neurips.cc/paper_files/paper/2021/file/2de5d16682c3c35007e4e92982f1a2ba-Paper.pdf)</sup> |

## 工作原理

UMAP假设数据近似均匀分布在一个流形上。在此假设下，以每个点为中心的单位球会伸展至第\( k \)个最近邻，从而赋予每个点各自局部变化的距离函数；由此得到的局部模糊单纯集被合并为数据的单一拓扑表示。<sup>[10](https://umap-learn.readthedocs.io/en/latest/how_umap_works.html)</sup> 当两个点对某条边的权重不一致时，权重a和b通过概率t-余范数合并为\( a + b - a \cdot b \)，解释为至少一条边存在的概率。<sup>[10](https://umap-learn.readthedocs.io/en/latest/how_umap_works.html)</sup>

给定一个低维布局，构建一个等价的模糊表示，并优化该布局以最小化两个表示在1-单纯形E上的交叉熵：

\[ C = \sum_{e \in E} w_{h}(e) \log \frac{w_{h}(e)}{w_{l}(e)} + (1 - w_{h}(e)) \log \frac{1 - w_{h}(e)}{1 - w_{l}(e)} \]

其中\( w_{h} \)和\( w_{l} \)分别是高维和低维的边权重。<sup>[10](https://umap-learn.readthedocs.io/en/latest/how_umap_works.html)</sup> 原则上，这与其他随机邻域嵌入方法使用的损失相同；区别在于概率分布的构造方式及其定义域。<sup>[11](https://link.springer.com/chapter/10.1007/978-3-031-97973-6_5)</sup> 模糊集机制借鉴了巴尔的模糊集理论<sup>[12](https://doi.org/10.4153/cmb-1986-079-9)</sup>以及班达里和帕尔的模糊集交叉熵度量<sup>[13](https://doi.org/10.1016/0020-0255%2893%2990073-u)</sup>。

## 实现方法

该算法分为两个阶段：构建加权k近邻图，然后计算该图的低维布局。<sup>[2](https://doi.org/10.48550/arxiv.1802.03426)</sup>

1. **最近邻图。** 使用最近邻下降法<sup>[10](https://umap-learn.readthedocs.io/en/latest/how_umap_works.html)</sup>寻找邻居，并在输入度量下将每个点到其最近邻的距离进行局部重新缩放，以创建逐点的模糊单纯集，通过模糊并集进行合并。<sup>[6](https://github.com/lmcinnes/umap/blob/master/umap/umap_.py)</sup>
2. **初始化。** 嵌入通过谱布局初始化，即在对称化模糊权重矩阵上使用拉普拉斯特征映射。<sup>[2](https://doi.org/10.48550/arxiv.1802.03426)</sup><sup> • </sup><sup>[11](https://link.springer.com/chapter/10.1007/978-3-031-97973-6_5)</sup>
3. **优化。** 边以概率方式采样，采用word2vec和LargeVis所使用的负采样，从而得到近似随机梯度下降。<sup>[2](https://doi.org/10.48550/arxiv.1802.03426)</sup> 低维隶属度曲线属于函数族\( 1/(1 + a x^{2b}) \)。<sup>[10](https://umap-learn.readthedocs.io/en/latest/how_umap_works.html)</sup>

邻居数n设定流形逼近的局部尺度：较小的值捕捉精细结构，较大的值捕捉大尺度结构。<sup>[2](https://doi.org/10.48550/arxiv.1802.03426)</sup> 默认值为15。min_dist控制点可以紧密排列的程度；原作者称其本质上是一个美学参数<sup>[2](https://doi.org/10.48550/arxiv.1802.03426)</sup>，但后来的分析认为它可以通过加权低维概率尾部强烈影响结果。<sup>[11](https://link.springer.com/chapter/10.1007/978-3-031-97973-6_5)</sup> 度量参数接受多种距离，包括余弦距离和相关距离。<sup>[5](https://github.com/lmcinnes/umap/)</sup> 优化工作量随模糊图中边的数量扩展，对于固定负采样，复杂度为\( O(k \cdot N) \)；最近邻下降的经验报道复杂度约为\( O(N^{1.14}) \)。<sup>[2](https://doi.org/10.48550/arxiv.1802.03426)</sup>

## 起源

UMAP由麦金尼斯、希利和梅尔维尔在2018年的一篇arXiv预印本中报道<sup>[2](https://doi.org/10.48550/arxiv.1802.03426)</sup>，同年麦金尼斯、希利、纳撒尼尔·索尔（Nathaniel Saul）和卢卡斯·格罗斯贝格尔（Lukas Großberger）在《开源软件杂志》上发表了配套的软件论文。<sup>[3](https://doi.org/10.21105/joss.00861)</sup> 它建立在《入门指南》所认定的前人工作之上：特南鲍姆、德席尔瓦和兰福德的[Isomap](https://www.edgepedia.org/zh/isomap)<sup>[14](https://doi.org/10.1126/science.290.5500.2319)</sup>，范德马滕和欣顿的t-SNE<sup>[1](https://www.nature.com/articles/s43586-024-00363-x)</sup>，以及贝尔金和尼约吉的拉普拉斯特征映射——后者也是谱初始化的基础。<sup>[15](https://doi.org/10.1162/089976603321780317)</sup> 希利和麦金尼斯经同行评审的《入门指南》于2024年发表在《自然综述：方法导论》上。<sup>[1](https://www.nature.com/articles/s43586-024-00363-x)</sup>

## 变体

参考实现通过部分标签支持监督和半监督降维，并可使用sklearn的transform方法将新点添加到已拟合的嵌入中。<sup>[3](https://doi.org/10.21105/joss.00861)</sup><sup> • </sup><sup>[5](https://github.com/lmcinnes/umap/)</sup> 由塞恩伯格、麦金尼斯和根特纳提出的参数化UMAP，将UMAP代价函数用作在小批量上训练的神经网络的损失，从而能够嵌入大型数据集。<sup>[16](https://doi.org/10.1162/neco_a_01434)</sup> 由纳拉扬、伯杰和赵提出的densMAP对代价函数进行正则化，以保留标准UMAP的均匀性假设所移除的局部密度信息。<sup>[17](https://doi.org/10.1038/s41587-020-00801-7)</sup> Aligned-UMAP已被应用于纵向生物医学研究。<sup>[18](https://doi.org/10.1016/j.patter.2023.100741)</sup> 在GPU方面，诺莱及其同事在cuML中引入了完全GPU加速的UMAP<sup>[19](https://doi.org/10.13016/m2sqzx-hybf)</sup>，cuML 25.06增加了多GPU kNN图构建。<sup>[8](https://developer.nvidia.com/blog/run-massive-scale-umap-in-minutes-using-multiple-gpus-without-losing-accuracy/)</sup>

## 应用

单细胞转录组学是一个被广泛记录的领域：贝希特及其同事于2018年将UMAP应用于单细胞数据可视化。<sup>[4](https://doi.org/10.1038/nbt.4314)</sup> 在一项针对30个模拟和5个真实单细胞数据集的十种降维方法基准测试中，UMAP表现出最高的稳定性、中等的准确性和第二高的计算成本，在所有模拟测试中轮廓系数显著高于其他方法。<sup>[20](https://www.frontiersin.org/journals/genetics/articles/10.3389/fgene.2021.646936/full)</sup>

在参考实现的基准测试中，MNIST在3.1 GHz Intel Core i7上42秒完成嵌入，Fashion MNIST为49秒，而scikit-learn的t-SNE在MNIST上大约需要45分钟。<sup>[5](https://github.com/lmcinnes/umap/)</sup> UMAP在嵌入维度超过2时比t-SNE扩展性更好，因为它不需要全局归一化，也不需要四叉树或八叉树——这些结构随维度呈指数扩展。<sup>[2](https://doi.org/10.48550/arxiv.1802.03426)</sup> GPU实现此后改变了局面：cuML 24.10的批量NN下降法带来了高达311倍的加速，将2000万点、384维的运行从10小时缩短到2分钟<sup>[7](https://developer.nvidia.com/blog/even-faster-and-more-scalable-umap-on-the-gpu-with-rapids-cuml/)</sup>；cuML 25.06的多GPU图构建在八块H100 GPU上8分钟内嵌入了1.06亿向量的MIRACL数据集，相对于预计的CPU运行时间实现了74倍的端到端加速。<sup>[8](https://developer.nvidia.com/blog/run-massive-scale-umap-in-minutes-using-multiple-gpus-without-losing-accuracy/)</sup>

## 局限性与替代方法

达姆里希和汉普雷希特表明，UMAP的负采样优化所最小化的有效损失与其声称的交叉熵显著不同：排斥项的权重被大幅降低，因此UMAP近似于高维相似度的二值化版本，除共享kNN图连通性之外的大部分信息基本上被忽略。<sup>[9](https://proceedings.neurips.cc/paper_files/paper/2021/file/2de5d16682c3c35007e4e92982f1a2ba-Paper.pdf)</sup> 在默认\( k = 15 \)和\( m = 5 \)下，对于\( n = 500 \)个点，高于0.2的输入相似度被映射为高于0.83的目标相似度，这解释了UMAP产生的清晰、过度收缩的子结构。<sup>[9](https://proceedings.neurips.cc/paper_files/paper/2021/file/2de5d16682c3c35007e4e92982f1a2ba-Paper.pdf)</sup>

原始论文声称UMAP“可以说比t-SNE保留了更多的全局结构”<sup>[2](https://doi.org/10.48550/arxiv.1802.03426)</sup>，但后来经同行评审的评估发现，t-SNE和UMAP都能很好地保留局部结构，但在全局结构上表现不佳，且两者都无法从局部到全局保留进行平滑调整。<sup>[21](https://jmlr.org/papers/volume22/20-1061/20-1061.pdf)</sup> 一项对转录组数据上八种方法的系统评估发现，t-SNE和UMAP对参数和预处理选择高度敏感，在全局结构指标上表现较弱，而PCA、TriMap、PaCMAP和ForceAtlas2则较为稳健。<sup>[22](https://www.nature.com/articles/s42003-022-03628-x)</sup> UMAP结果在单细胞数据的网格搜索中在不同超参数设置下也发生了剧烈变化<sup>[20](https://www.frontiersin.org/journals/genetics/articles/10.3389/fgene.2021.646936/full)</sup>，且通常对预处理中选择的主成分数量不稳健。<sup>[22](https://www.nature.com/articles/s42003-022-03628-x)</sup> 由露西·夏（Lucy Xia）、克里斯蒂·李（Christy Lee）和杰西卡·李（Jingyi Jessica Li）提出的scDEED方法可检测可疑的二维单细胞嵌入，并优化t-SNE和UMAP的超参数。<sup>[23](https://doi.org/10.1038/s41467-024-45891-y)</sup>

虚假聚类是实际风险：保留局部但不保留全局结构的方法可能将“虚假”聚类呈现为真实，从而产生错误假设。在一个59,286细胞的PBMC基准测试中，UMAP将两个树突状细胞亚群分隔为空间上相距较远的组，而t-SNE、TriMap和PaCMAP将它们映射得很近。<sup>[22](https://www.nature.com/articles/s42003-022-03628-x)</sup> 查里和帕赫特在2023年认为此类嵌入是似是而非的；2024年的一篇反驳发现在三个scRNA-seq数据集上，UMAP和t-SNE的kNN准确率高于90%，而PCA低于62%，尽管所有方法的kNN召回率均低于40%，该反驳支持将二维嵌入用于探索性假设生成，同时同意它们不应用于定量下游分析。<sup>[24](https://doi.org/10.1371/journal.pcbi.1011288)</sup><sup> • </sup><sup>[25](https://journals.plos.org/ploscompbiol/article?id=10.1371%2Fjournal.pcbi.1012403)</sup>

失败模式包括连通流形假设：参考实现提供了一个disconnection_distance参数，当点与所有其他点差异最大时，断开距离超过阈值的顶点。<sup>[6](https://github.com/lmcinnes/umap/blob/master/umap/umap_.py)</sup> 替代方法包括PaCMAP，它增加了中近点和更远点损失项以同时保留局部和全局结构<sup>[21](https://jmlr.org/papers/volume22/20-1061/20-1061.pdf)</sup>，以及TriMap<sup>[26](https://doi.org/10.48550/arxiv.1910.00204)</sup>和用于密度保留的densMAP。<sup>[17](https://doi.org/10.1038/s41587-020-00801-7)</sup>

## References

1. [Uniform manifold approximation and projection | Nature Reviews Methods Primers (Healy & McInnes, 2024)](https://www.nature.com/articles/s43586-024-00363-x)
2. [McInnes, Leland, Healy, John, Melville, James (2018). UMAP: Uniform Manifold Approximation and Projection for Dimension Reduction. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1802.03426)
3. [Leland McInnes and colleagues (2018). UMAP: Uniform Manifold Approximation and Projection. The Journal of Open Source Software.](https://doi.org/10.21105/joss.00861)
4. [Etienne Becht and colleagues (2018). Dimensionality reduction for visualizing single-cell data using UMAP. Nature Biotechnology.](https://doi.org/10.1038/nbt.4314)
5. [lmcinnes/umap (official repository README)](https://github.com/lmcinnes/umap/)
6. [umap/umap_.py reference implementation source (docstrings)](https://github.com/lmcinnes/umap/blob/master/umap/umap_.py)
7. [Even Faster and More Scalable UMAP on the GPU with NVIDIA cuML](https://developer.nvidia.com/blog/even-faster-and-more-scalable-umap-on-the-gpu-with-rapids-cuml/)
8. [Run Massive-Scale UMAP in Minutes Using Multiple GPUs, Without Losing Accuracy](https://developer.nvidia.com/blog/run-massive-scale-umap-in-minutes-using-multiple-gpus-without-losing-accuracy/)
9. [On UMAP's True Loss Function (NeurIPS 2021)](https://proceedings.neurips.cc/paper_files/paper/2021/file/2de5d16682c3c35007e4e92982f1a2ba-Paper.pdf)
10. [How UMAP Works (author documentation)](https://umap-learn.readthedocs.io/en/latest/how_umap_works.html)
11. [UMAP (Springer chapter critically assessing the algorithm's strategy)](https://link.springer.com/chapter/10.1007/978-3-031-97973-6_5)
12. [Michael Barr (1986). Fuzzy Set Theory and Topos Theory. Canadian Mathematical Bulletin.](https://doi.org/10.4153/cmb-1986-079-9)
13. [Some new information measures for fuzzy sets (Information Sciences, 1993)](https://doi.org/10.1016/0020-0255%2893%2990073-u)
14. [Joshua B. Tenenbaum, Vin de Silva, John C. Langford (2000). A Global Geometric Framework for Nonlinear Dimensionality Reduction. Science.](https://doi.org/10.1126/science.290.5500.2319)
15. [Mikhail Belkin, Partha Niyogi (2003). Laplacian Eigenmaps for Dimensionality Reduction and Data Representation. Neural Computation.](https://doi.org/10.1162/089976603321780317)
16. [Tim Sainburg, Leland McInnes, Timothy Q. Gentner (2021). Parametric UMAP Embeddings for Representation and Semisupervised Learning. Neural Computation.](https://doi.org/10.1162/neco_a_01434)
17. [Ashwin Narayan, Bonnie Berger, Hyunghoon Cho (2021). Assessing single-cell transcriptomic variability through density-preserving data visualization. Nature Biotechnology.](https://doi.org/10.1038/s41587-020-00801-7)
18. [Anant Dadu and colleagues (2023). Application of Aligned-UMAP to longitudinal biomedical studies. Patterns.](https://doi.org/10.1016/j.patter.2023.100741)
19. [Nolet, Corey J. and colleagues (2020). Bringing UMAP Closer to the Speed of Light with GPU Acceleration. arXiv (Cornell University).](https://doi.org/10.13016/m2sqzx-hybf)
20. [A Comparison for Dimensionality Reduction Methods of Single-Cell RNA-seq Data (Frontiers in Genetics 2021)](https://www.frontiersin.org/journals/genetics/articles/10.3389/fgene.2021.646936/full)
21. [Understanding How Dimension Reduction Tools Work: An Empirical Approach to Deciphering t-SNE, UMAP, TriMap, and PaCMAP (Wang et al., JMLR)](https://jmlr.org/papers/volume22/20-1061/20-1061.pdf)
22. [Towards a comprehensive evaluation of dimension reduction methods for transcriptomic data visualization (Communications Biology 2022)](https://www.nature.com/articles/s42003-022-03628-x)
23. [Lucy Xia, Christy Lee, Jingyi Jessica Li (2024). Statistical method scDEED for detecting dubious 2D single-cell embeddings and optimizing t-SNE and UMAP hyperparameters. Nature Communications.](https://doi.org/10.1038/s41467-024-45891-y)
24. [Tara Chari, Lior Pachter (2023). The specious art of single-cell genomics. PLoS Computational Biology.](https://doi.org/10.1371/journal.pcbi.1011288)
25. [The art of seeing the elephant in the room: 2D embeddings of single-cell data do make sense (PLOS Computational Biology, 2024)](https://journals.plos.org/ploscompbiol/article?id=10.1371%2Fjournal.pcbi.1012403)
26. [Amid, Ehsan, Warmuth, Manfred K. (2019). TriMap: Large-scale Dimensionality Reduction Using Triplets. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1910.00204)

---
*Initially written Sep 29, 2026 · Edited: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Machine learning and neural computation › Machine learning methods › Supervised, unsupervised, and semi-supervised learning › Dimensionality reduction and manifold learning

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/umap

English original: https://www.edgepedia.org/umap
