# 神经气

**神经气**是一种无监督的向量量化算法，其中一组原型（权重）向量通过基于排名的——或称“软最大”——更新规则进行自适应调整：每输入一个输入向量后，每个原型都向该输入移动，移动量随该原型在所有原型中的距离排名呈指数衰减。该算法由托马斯·马蒂内茨（Thomas Martinetz）和[克劳斯·舒尔滕](https://www.edgepedia.org/zh/klaus-schulten)（Klaus Schulten）于1991年提出，并在1993年与斯坦尼斯拉夫·别尔科维奇（Stanislav Berkovich）合著的《IEEE神经网络汇刊》论文中作为K均值聚类的扩展作了详细描述。<sup>[1](http://www.ks.uiuc.edu/Publications/Papers/PDF/MART93B/MART93B.pdf)</sup><sup> • </sup><sup>[23](https://www.ks.uiuc.edu/Publications/Papers/paper.cgi?tbcode=MART91B)</sup> 其名称反映了参考向量的动态特性——它们像气体分子一样在输入空间中分布自身。<sup>[1](http://www.ks.uiuc.edu/Publications/Papers/PDF/MART93B/MART93B.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 起源 | 用于向量量化的“神经气”网络，托马斯·马蒂内茨、斯坦尼斯拉夫·别尔科维奇和克劳斯·舒尔滕，《IEEE神经网络汇刊》，1993<sup>[1](http://www.ks.uiuc.edu/Publications/Papers/PDF/MART93B/MART93B.pdf)</sup> |
| 更新规则 | 在代价函数上执行随机梯度下降，邻域函数为 \( h_{\lambda}(t) = \exp(-t/\lambda) \)，作用于距离排名<sup>[2](https://arxiv.org/html/math/0610561)</sup> |
| 极限情形 | 当 \( \lambda \to 0 \) 时，神经气等同于胜者为王训练，即K均值更新<sup>[3](https://www.esann.org/sites/default/files/proceedings/legacy/es2007-59.pdf)</sup> |
| 原始参数 | \( \lambda_i = 30 \)，\( \lambda_f = 0.01 \)，\( \varepsilon_i = 0.3 \)，\( \varepsilon_f = 0.05 \)，\( T_i = 20 \)，\( T_f = 200 \)<sup>[4](https://tum.neurocomputing.systems/fileadmin/w00bqs/www/publications/as/2014WS-HS-GrowingNeuralGas.pdf)</sup> |
| 排名开销 | 对所有距离排序主导了处理时间，对N个单元的顺序处理给出 \( O(N \log N) \) 复杂度<sup>[4](https://tum.neurocomputing.systems/fileadmin/w00bqs/www/publications/as/2014WS-HS-GrowingNeuralGas.pdf)</sup> |
| 增长变体 | 增长神经气（贝恩德·弗里茨克，NeurIPS 1994）每隔λ个信号在累积误差最大的单元之间插入新单元，并移除年龄超过最大值的边<sup>[5](https://proceedings.neurips.cc/paper_files/paper/1994/file/d56b9fc4b0f1be8871f5e1c40c0067e7-Paper.pdf)</sup> |
| 量化质量 | 在对比实验中，神经元数量大致相同时，神经气的量化误差显著小于SOM<sup>[6](https://doi.org/10.15388/informatica.2011.317)</sup> |

## 算法

神经气在输入空间中维护N个参考向量 \( w_i \)。每次呈现输入向量x时，算法计算距离 \( d(x, w_i) \)，对其排序，并为每个原型分配其排名 \( k_i \)，即 \( w_i \) 在从最近到最远排序中的位置。自适应步骤是在代价函数上的随机梯度下降：

\[ E_{\mathrm{NG}}(w) = \frac{1}{2C(\lambda)} \sum_i \int h_{\lambda}(k_i(x,w)) \, d(x, w_i) \, P(dx), \]

其中 \( k_i \) 是原型i的排名，\( h_{\lambda}(t) = \exp(-t/\lambda) \) 是作用于排名的类高斯邻域函数，邻域范围 \( \lambda > 0 \)，\( C(\lambda) \) 为归一化常数。学习规则为：

\[ \Delta w_i = \varepsilon \cdot h_{\lambda}(k_i(x,w)) \cdot (x - w_i). \]<sup>[2](https://arxiv.org/html/math/0610561)</sup>

因此更新强度随排名呈指数衰减：最近的原型移动最多，次近的稍少，依此类推。邻域范围 \( \lambda \) 和学习率 \( \varepsilon \) 均在初始时设得较大，训练过程中递减。在托马斯·马蒂内茨和克劳斯·舒尔滕原始工作的参数化中，\( \lambda \) 从 \( \lambda_i = 30 \) 衰减至 \( \lambda_f = 0.01 \)，学习率从 \( \varepsilon_i = 0.3 \) 衰减至 \( \varepsilon_f = 0.05 \)，退火时间为 \( T_i = 20 \) 和 \( T_f = 200 \)。<sup>[3](https://www.esann.org/sites/default/files/proceedings/legacy/es2007-59.pdf)</sup><sup> • </sup><sup>[4](https://tum.neurocomputing.systems/fileadmin/w00bqs/www/publications/as/2014WS-HS-GrowingNeuralGas.pdf)</sup> 典型实现将更新写为 \( w_k(t+1) = w_k(t) + E(t) h_{\lambda}(r_k(x_l,w(t))) \)，其中学习率按指数衰减 \( E(t) = E_g (E_f / E_g)^{t/t_{\max}} \)，\( r_k(x_l,w(t)) \) 是原型 \( w_k \) 对输入 \( x_l \) 的距离排名。<sup>[6](https://doi.org/10.15388/informatica.2011.317)</sup>

邻域范围控制学习所处的模式。当 \( \lambda \neq 0 \) 时，算法实现胜者多得学习，即每个输入拉动多个邻近原型；当 \( \lambda \to 0 \) 时，只有胜者自适应，神经气等同于胜者为王训练，即K均值更新。<sup>[4](https://tum.neurocomputing.systems/fileadmin/w00bqs/www/publications/as/2014WS-HS-GrowingNeuralGas.pdf)</sup><sup> • </sup><sup>[3](https://www.esann.org/sites/default/files/proceedings/legacy/es2007-59.pdf)</sup> 中间模式正是该方法鲁棒性的来源：对三个原型的精确分析表明，胜者为王训练收敛到最佳渐近量化误差，但高度依赖初始化，而基于排名的方法——尤其是神经气——既实现了对初始条件的鲁棒性，又达到了最佳渐近量化误差，且收敛速度相当或更优。<sup>[3](https://www.esann.org/sites/default/files/proceedings/legacy/es2007-59.pdf)</sup>

## 增长神经气及变体

**增长神经气。** 普通神经气的节点数固定，因此网络规模必须预先设定。<sup>[7](https://link.springer.com/article/10.1007/s00521-016-2579-y)</sup> 贝恩德·弗里茨克（Bernd Fritzke）的增长神经气（GNG）在NeurIPS 1994上提出，通过将增长细胞结构的增长机制与竞争性赫布学习（competitive Hebbian learning）的拓扑生成相结合，消除了这一要求。每隔λ个输入信号，在累积误差最大的单元与其误差变量最大的邻居之间插入一个新单元，置于两者中点（\( w_r = 0.5(w_q + w_f) \)）。年龄超过最大年龄参数的边被移除，没有发出边的单元也被移除。为每个输入在最近和次近单元之间插入边，构造输入分布的诱导Delaunay三角剖分，增长持续到满足用户定义的性能标准或网络规模。与神经气和Kohonen特征映射不同，GNG没有随时间变化的参数。<sup>[5](https://proceedings.neurips.cc/paper_files/paper/1994/file/d56b9fc4b0f1be8871f5e1c40c0067e7-Paper.pdf)</sup>

应用研究中报告的典型GNG设置为 \( \lambda = 100 \) 至1000，学习率 \( \varepsilon_x = 0.1 \) 和 \( \varepsilon_n = 0.005 \)，最大边年龄 \( \alpha_{\max} = 125 \)；在2D/3D物体表示实验中，最优节点数在90至130之间，且一旦网络至少发展了一半，添加节点不影响拓扑保持。更快的GNG变体以拓扑保持换取更快收敛，适用于机器人中的在线障碍物检测。<sup>[7](https://link.springer.com/article/10.1007/s00521-016-2579-y)</sup>

**后续变体。** GNG家族已在多个方向上得到扩展。GNG-U定义了一种效用度量，移除位于低密度区域的神经元并将其重新插入高密度区域；按需增长（GWR）网络根据活动或发放阈值增长；在线GNG自动拟合网络规模。<sup>[8](https://www.mdpi.com/2076-3417/14/10/4139)</sup> 合并神经气（Merge Neural Gas）是合并SOM与神经气的综合，添加了上下文向量，使算法能够处理DNA链和语音发音等时间序列；神经气本身已应用于Mackey–Glass函数逼近、语音识别、图像处理和模式识别。<sup>[4](https://tum.neurocomputing.systems/fileadmin/w00bqs/www/publications/as/2014WS-HS-GrowingNeuralGas.pdf)</sup> 批量神经气通过牛顿型更新优化相同的代价函数，收敛速度可比在线规则快得多；中位数变体将该方法扩展到非向量邻近数据。<sup>[2](https://arxiv.org/html/math/0610561)</sup> 稀疏编码神经气为稀疏字典学习重新表述了目标函数，每次更新步骤开销为 \( O(MN + M \log M) \)，对于 \( t_{\max} \) 次迭代、每次k个更新步骤，总体复杂度为 \( O(t_{\max} \cdot k \cdot (MN + M \log M)) \)。<sup>[9](https://www.inb.uni-luebeck.de/fileadmin/files/publications/inb-publications/pdfs/LaBaMa09.pdf)</sup> 现代软件还提供通过反向传播优化的可微神经气目标，与经典在线算法和GNG并存。<sup>[10](https://github.com/francesco-p/ngas-pytorch)</sup>

## 与K均值及自组织映射的关系

神经气通过添加邻域合作来推广K均值：不是只有获胜原型自适应，而是所有原型都按其排名设定的强度自适应。这种合作使该方法比K均值对初始化更不敏感，也更不容易陷入简单向量量化的局部极小问题。<sup>[2](https://arxiv.org/html/math/0610561)</sup><sup> • </sup><sup>[3](https://www.esann.org/sites/default/files/proceedings/legacy/es2007-59.pdf)</sup>

与Kohonen的自组织映射（SOM）相比，神经气有两个结构差异。第一，它不需要固定的低维邻域网格；邻域由输入空间中的排名定义，因此方法自动确定数据最优网格，没有拓扑限制。<sup>[1](http://www.ks.uiuc.edu/Publications/Papers/PDF/MART93B/MART93B.pdf)</sup><sup> • </sup><sup>[2](https://arxiv.org/html/math/0610561)</sup> 第二，神经气优化显式代价函数，而标准SOM的自适应规则通常不与显式代价函数相关联。因此，神经气可以与托马斯·马蒂内茨和克劳斯·舒尔滕的竞争性赫布规则结合，该规则在经常对同一输入分别为最近和次近的单元之间形成连接，产生支持在线数据可视化的拓扑。<sup>[11](https://www.sciencedirect.com/science/article/abs/pii/S0893608006000785)</sup>

## 比较：量化误差、拓扑保持与开销

**对比SOM。** 在一项以获胜神经元数量为函数测量量化误差的比较研究中，神经元数量大致相同时，神经气的量化误差显著小于SOM，作者据此得出结论：神经气更适合向量量化；拓扑保持则用König度量 \( E_{KM} \) 单独评估（\( \mu = 4 \)，\( \nu \) 从6到50）。<sup>[6](https://doi.org/10.15388/informatica.2011.317)</sup>

**对比K均值。** 在真实和模拟数据集上的基准比较发现，神经气和GNG优化代价函数且独立于初始数据划分；K均值也最小化代价函数——簇内平方和——但其结果依赖于初始数据划分。<sup>[12](https://pubs.acs.org/jcisd8/article/42/6/1378/3504062/On-the-Optimal-Partitioning-of-Data-with-K-Means)</sup><sup> • </sup><sup>[24](https://scikit-learn.org/stable/modules/clustering.html?highlight=hdbscan)</sup>

**鲁棒性局限。** 鲁棒性主张有其边界：神经气对离群点敏感，因为离群点会影响自适应步骤；当分布假设被违反时，它可能无法保持特征空间的拓扑。基于M估计器的鲁棒变体限制了离群观测的影响，在静态聚类任务上优于原始算法。<sup>[13](https://link.springer.com/chapter/10.1007/11892755_58)</sup>

**计算开销。** 排名步骤占主导：每次呈现都必须对所有距离排序，对N个单元的顺序处理给出 \( O(N \log N) \) 复杂度。<sup>[4](https://tum.neurocomputing.systems/fileadmin/w00bqs/www/publications/as/2014WS-HS-GrowingNeuralGas.pdf)</sup> 这是基于排名的邻域所付出的代价，也正是批量、分布式和流式变体（见下文）所针对的问题。

## 应用与实现

神经气和GNG用于需要对流式或空间结构化数据进行自适应、拓扑感知量化的场合：

- **数据压缩与搜索。** 神经气向量量化用数值较小的整数码本索引列表替代由大向量组成的数据集；现代向量数据库使用此类量化标签进行近似最近邻搜索，多媒体应用中传输的是索引而非数据。<sup>[14](https://eng.libretexts.org/Courses/University_of_Illinois_Springfield/Ancillary_Materials_for_The_Shallow_and_the_Deep_by_M._Biehl/06%3A_Distance-based_Classifiers/6.1%3A_Chapter_6_Summary_and_a_Discussion_on_the_Neural_Gas_Model)</sup>
- **异常检测。** 一个新向量如果离其最近原型太远——即量化误差高——可被标记为异常或噪声。<sup>[14](https://eng.libretexts.org/Courses/University_of_Illinois_Springfield/Ancillary_Materials_for_The_Shallow_and_the_Deep_by_M._Biehl/06%3A_Distance-based_Classifiers/6.1%3A_Chapter_6_Summary_and_a_Discussion_on_the_Neural_Gas_Model)</sup> 一个具有在线神经元插入、删除、学习率自适应和停止准则的在线GNG模型被应用于UMN、UCSD Ped1/Ped2和Avenue数据集上的视频监控无监督异常检测，能够快速适应场景变化并减少误报，同时仍检测到大多数异常。<sup>[15](https://ink.library.smu.edu.sg/cgi/viewcontent.cgi?article=5457&context=sis_research)</sup>
- **聚类。** 基于GNG的近似谱聚类使用参考向量进行向量量化，并利用学习到的网络拓扑提取数据点之间的拓扑关系。<sup>[16](https://pmc.ncbi.nlm.nih.gov/articles/PMC8384042/)</sup>
- **物体表示与机器人。** GNG已用于2D/3D物体表示，在更快的变体中用于在线障碍物检测。<sup>[7](https://link.springer.com/article/10.1007/s00521-016-2579-y)</sup>
- **时间序列预测。** 1993年的原始论文将该网络应用于时间序列预测。<sup>[1](http://www.ks.uiuc.edu/Publications/Papers/PDF/MART93B/MART93B.pdf)</sup>

可用的实现包括ngas-pytorch库，提供经典在线神经气、以排名平方的倒数为邻域函数的变体、增长神经气以及可微变体，超参数包括n_neurons、lr、max_edge_age和距离度量，并有quantization_error方法；典型调用为 `NeuralGas(n_neurons=10, lr=0.02, max_edge_age=100, distance="l2")`。<sup>[10](https://github.com/francesco-p/ngas-pytorch)</sup> 莱比锡大学机器人组的模拟器也按照托马斯·马蒂内茨的方案实现了神经气，参数包括邻域学习常数lambda、初始学习率eps和退火时间maxTime。<sup>[17](https://robot.informatik.uni-leipzig.de/software/doc/html/classNeuralGas.html)</sup>

## 近期进展

近期工作集中在流式数据、速度和工业应用上：

- **StreamSoNG（2024）** 是一种流式软神经气算法，用于无界数据流的在线分类，如网络数据包或连续实时视频帧，这些场景下对全数据集运行迭代算法不可行。<sup>[18](https://doi.org/10.1109/tetci.2024.3399655)</sup>
- **AiGAS-dEVL-RC（2025）** 是一种自适应GNG模型，用于极端验证延迟下的循环漂移无监督数据流；它利用GNG无需预设神经元数量并按需添加单元的特性来发现网络结构。<sup>[19](https://arxiv.org/html/2504.05761)</sup>
- **DBL-GNG（2024）** 用基于矩阵的批量学习、分布式初始化、同时多节点插入和边切割取代基于循环的GNG学习；在较小数据集上比其他GNG方法快至少10倍，在大规模数据集上快至少20倍，聚类性能优于K均值和DBSCAN，并支持3D点云的实时拓扑映射。<sup>[20](https://www.mdpi.com/2227-7390/12/12/1909)</sup>
- **BOA-GNG（2024）** 将贝叶斯超参数搜索而非网格搜索应用于GNG，用于工业流式数据的在线异常检测；在六个数据集上精确率和召回率均超过95%，学习和检测速度分别接近每秒500和4000个数据点。<sup>[8](https://www.mdpi.com/2076-3417/14/10/4139)</sup>
- **NGPCA（2024）** 添加了自适应逐单元学习率，根据每个单元对其所代表数据分布部分的拟合程度单独更新，并添加自适应势函数用于高维非平稳数据流的聚类；所有参数在每个数据点上更新，使算法无需预训练或批量组件即可在线运行。<sup>[21](https://doi.org/10.1016/j.simpa.2024.100635)</sup>
- **ASGNG（2025）** 是一种基于GNG的主动表面重建方法，引入了使用主动边的边惩罚机制和主动表面创建机制，扩展了先前的GSRM和SGNG方法。<sup>[22](https://www.sciencedirect.com/science/article/abs/pii/S0097849325000238)</sup>

## References

1. [Martinetz, Berkovich & Schulten (1993). 'Neural-gas' network for vector quantization and its application to time-series prediction. IEEE Transactions on Neural Networks.](http://www.ks.uiuc.edu/Publications/Papers/PDF/MART93B/MART93B.pdf)
2. [Batch and median neural gas (arXiv math/0610561)](https://arxiv.org/html/math/0610561)
3. [On the Dynamics of Vector Quantization and Neural Gas. ESANN 2007.](https://www.esann.org/sites/default/files/proceedings/legacy/es2007-59.pdf)
4. [Growing Neural Gas for Time Series Prediction. TUM Neurocomputing Systems report.](https://tum.neurocomputing.systems/fileadmin/w00bqs/www/publications/as/2014WS-HS-GrowingNeuralGas.pdf)
5. [Fritzke (1994). A Growing Neural Gas Network Learns Topologies. NeurIPS.](https://proceedings.neurips.cc/paper_files/paper/1994/file/d56b9fc4b0f1be8871f5e1c40c0067e7-Paper.pdf)
6. [Quality of Quantization and Visualization of Vectors Obtained by Neural Gas and Self-Organizing Map. Informatica, 2011.](https://doi.org/10.15388/informatica.2011.317)
7. [Fast 2D/3D object representation with growing neural gas. Neural Computing and Applications.](https://link.springer.com/article/10.1007/s00521-016-2579-y)
8. [Bayes-Optimized Adaptive Growing Neural Gas Method for Online Anomaly Detection of Industrial Streaming Data. MDPI Applied Sciences, 2024.](https://www.mdpi.com/2076-3417/14/10/4139)
9. [Sparse Coding Neural Gas. University of Lübeck.](https://www.inb.uni-luebeck.de/fileadmin/files/publications/inb-publications/pdfs/LaBaMa09.pdf)
10. [ngas-pytorch reference implementations of Neural Gas variants. GitHub.](https://github.com/francesco-p/ngas-pytorch)
11. [Online data visualization using the neural gas network. Neural Networks, 2006.](https://www.sciencedirect.com/science/article/abs/pii/S0893608006000785)
12. [On the Optimal Partitioning of Data with K-Means, Growing K-Means, Neural Gas, and Growing Neural Gas. J. Chem. Inf. Comput. Sci., 2002.](https://pubs.acs.org/jcisd8/article/42/6/1378/3504062/On-the-Optimal-Partitioning-of-Data-with-K-Means)
13. [Robustness Analysis of the Neural Gas Learning Algorithm. ICANN 2006, Springer.](https://link.springer.com/chapter/10.1007/11892755_58)
14. [Chapter 6 Summary and a Discussion on the Neural Gas Model, ancillary materials for The Shallow and the Deep by M. Biehl.](https://eng.libretexts.org/Courses/University_of_Illinois_Springfield/Ancillary_Materials_for_The_Shallow_and_the_Deep_by_M._Biehl/06%3A_Distance-based_Classifiers/6.1%3A_Chapter_6_Summary_and_a_Discussion_on_the_Neural_Gas_Model)
15. [Online growing neural gas for anomaly detection in changing surveillance scenes.](https://ink.library.smu.edu.sg/cgi/viewcontent.cgi?article=5457&context=sis_research)
16. [Approximate spectral clustering using both reference vectors and topology of the network generated by growing neural gas. PMC, 2021.](https://pmc.ncbi.nlm.nih.gov/articles/PMC8384042/)
17. [NeuralGas Class Reference, University of Leipzig Robotics Group simulator.](https://robot.informatik.uni-leipzig.de/software/doc/html/classNeuralGas.html)
18. [StreamSoNGv2: Online Classification of Data Streams Using Growing Neural Gas. IEEE TETCI, 2024.](https://doi.org/10.1109/tetci.2024.3399655)
19. [AiGAS-dEVL-RC: An Adaptive Growing Neural Gas Model for Recurrently Drifting Unsupervised Data Streams. arXiv, 2025.](https://arxiv.org/html/2504.05761)
20. [Distributed Batch Learning of Growing Neural Gas for Quick and Efficient Clustering. MDPI Mathematics, 2024.](https://www.mdpi.com/2227-7390/12/12/1909)
21. [NGPCA: Clustering of high-dimensional and non-stationary data streams (Migenda et al., 2024).](https://doi.org/10.1016/j.simpa.2024.100635)
22. [An active surface reconstruction method based on growing neural gas (ASGNG). Computers & Graphics, 2025.](https://www.sciencedirect.com/science/article/abs/pii/S0097849325000238)
23. [TCB Publications - Abstract](https://www.ks.uiuc.edu/Publications/Papers/paper.cgi?tbcode=MART91B)
24. [2.3. Clustering](https://scikit-learn.org/stable/modules/clustering.html?highlight=hdbscan)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Machine learning and neural computation › Neural networks and deep learning › Titles I to Z

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/neural-gas

English original: https://www.edgepedia.org/neural-gas
