# 数据流挖掘

数据流挖掘是一类机器学习方法，它在“每个样本在被丢弃之前只能查看一次”这一约束下，从连续、高容量的数据流中提取模式并构建预测模型。它与批学习在三个运行要求上有所不同：每个样本的处理时间受到严格限制；内存有限，且与流的长度无关；模型必须适应非平稳分布。<sup>[1](https://www.cs.put.poznan.pl/dbrzezinski/publications/Stream_Classification.pdf)</sup> 其输出是一个随时可用模型（anytime model），在样本之间随时可以预测，并随数据到达而增量更新。该范式涵盖分类、回归、聚类和频繁模式挖掘，其动因来自物联网设备和社交网络的数据——这些数据的到达速率使其无法被完整存储。<sup>[2](https://wires.onlinelibrary.wiley.com/doi/10.1002/widm.1405)</sup>

| 关键事实 | 数值 |
|---|---|
| 奠基算法 | VFDT，由佩德罗·多明戈斯（Pedro Domingos）和杰夫·赫尔滕（Geoff Hulten）在 KDD 2000 上报告<sup>[3](https://doi.org/10.1145/347090.347107)</sup> |
| 吞吐量（VFDT） | 在现成硬件上每秒数万个样本；约每天十亿个样本<sup>[3](https://doi.org/10.1145/347090.347107)</sup><sup> • </sup><sup>[4](https://homes.cs.washington.edu/~pedrod/papers/jcgs03.pdf)</sup> |
| 每个叶节点的内存 | \( O(d \cdot v \cdot c) \)，d 为属性数，v 为每属性取值数，c 为类别数<sup>[3](https://doi.org/10.1145/347090.347107)</sup> |
| 分裂规则 | 当 \( \Delta G > \varepsilon \) 时分裂，其中 \( \varepsilon = \sqrt{R^{2} \ln(1/\delta)/(2n)} \)<sup>[3](https://doi.org/10.1145/347090.347107)</sup> |
| MOA 默认参数 | \( n_{\mathrm{min}} = 1000 \)，\( \delta = 10^{-8} \)，\( \tau = 0.05 \)<sup>[5](https://moa.cms.waikato.ac.nz/wp-content/uploads/2010/05/Manual.pdf)</sup> |
| ARF 吞吐量 | 100 棵霍夫丁树、10 万样本、30 个特征时，MOA 中每实例 2.4 ms<sup>[6](https://arxiv.org/html/2502.16840v2)</sup> |
| 标准评估 | 交错测试-训练（prequential）与留出法；交叉验证被认为代价过高<sup>[1](https://www.cs.put.poznan.pl/dbrzezinski/publications/Stream_Classification.pdf)</sup> |

## 工作原理

核心机制是基于充分统计量的增量学习。霍夫丁树（Hoeffding tree）在每个叶节点累积计数表 n(i,j,c)，记录特征值 \( x_{i} = v_{j} \) 的各类别样本数；内存取决于叶节点的数量，而与流的长度无关。<sup>[7](http://library.usc.edu.ph/ACM/KKD%202017/pdfs/p1733.pdf)</sup> 当两个属性竞争一次分裂时，霍夫丁界（Hoeffding bound）决定需要多少样本：以概率 1 − δ，取值范围为 R 的变量的真实均值与 n 次观测后的观测均值之差至多为 \( \varepsilon = \sqrt{R^{2} \ln(1/\delta)/(2n)} \)。若观测到的增益差 \( \Delta G = G(X_{a}) - G(X_{b}) \) 超过 ε，则属性 \( X_{\mathrm{a}} \) 以概率 1 − δ 是正确选择。<sup>[3](https://doi.org/10.1145/347090.347107)</sup> 该界来自[瓦西里·霍夫丁](https://www.edgepedia.org/zh/wassily-hoeffding)（Wassily Hoeffding）1963 年发表于《[美国统计协会杂志](https://www.edgepedia.org/zh/journal-of-the-american-statistical-association)》（Journal of the American Statistical Association）的关于有界随机变量之和的概率不等式的论文。<sup>[8](https://doi.org/10.1080/01621459.1963.10500830)</sup>

由于每次分裂决策的出错概率至多为 δ，且与批学习器选择不同分裂测试的概率随所见样本数指数下降，树的输出渐近地几乎与批处理树相同。<sup>[3](https://doi.org/10.1145/347090.347107)</sup> 多明戈斯和赫尔滕的通用框架对此作了推广：若最多做出 d 次决策，每次在 b 个备选方案中选择、每步进行 c 次检查，则并集界（union bound）将整个模型与无限数据模型不同的概率上限定为 \( \delta_{\mathrm{total}} = b \cdot c \cdot d \cdot \delta \)。<sup>[4](https://homes.cs.washington.edu/~pedrod/papers/jcgs03.pdf)</sup> 已发表的批评意见认为，视对分裂评估分布的假设而定，麦克迪尔米德（McDiarmid）不等式可能更为适用，<sup>[1](https://www.cs.put.poznan.pl/dbrzezinski/publications/Stream_Classification.pdf)</sup> 也有人提出该界在统计上不适合用于构建流式决策树。<sup>[9](https://link.springer.com/article/10.1007/s42452-019-1433-0)</sup>

概念漂移（concept drift）是模型必须学习的分布随时间发生的变化；在监督设置中，它可能影响后验 P(y\|x)、条件特征分布 P(x\|y)、特征分布 P(x) 或类别先验 P(y)。<sup>[10](https://www.kdd.org/exploration_files/16-1-2014.pdf)</sup> 漂移分为突变型（一种分布被完全替换）、渐变型（较缓慢的过渡）和复现型（旧概念在一段时间后重新出现）。<sup>[9](https://link.springer.com/article/10.1007/s42452-019-1433-0)</sup> 处理机制可归为若干族系。概念自适应极快决策树（CVFDT）每当旧子树变得可疑时就生长一棵备选子树，并在新子树更准确时将其替换，其每样本代价为 O(1)，而将 VFDT 重新应用于大小为 w 的窗口则为 O(w)。<sup>[11](https://dl.acm.org/doi/10.1145/502512.502529)</sup> ADWIN 维护一个可变长度窗口，在无明显变化时增长，在数据变化时收缩；其唯一参数是置信界 δ，而实用的 ADWIN2 变体以 \( O(\log W) \) 的内存和更新时间维护长度为 W 的窗口。<sup>[12](https://www.cs.upc.edu/%7Egavalda/papers/adwin06.pdf)</sup> 错误率检测器将分类错误建模为二项试验，包括漂移检测方法（DDM）、早期漂移检测方法（EDDM）和指数加权移动平均（EWMA），以及[累积和](https://www.edgepedia.org/zh/cusum)（CUSUM）和 Page-Hinkley 检验等序贯检验；综述还将 KSWIN 和 HDDM 等自适应窗口检测器与 ADWIN 归为一类，并指出 DDM 仍是最快、最精确的方法之一。<sup>[1](https://www.cs.put.poznan.pl/dbrzezinski/publications/Stream_Classification.pdf)</sup><sup> • </sup><sup>[13](https://link.springer.com/article/10.1007/s13042-024-02492-x)</sup>

## 实施方法

实践者运行一条由流式数据摄入、增量模型更新和漂移监控组成的流水线，然后进行在线评估。两种标准协议是留出法评估和交错测试-训练（prequential）——后者先用每个样本测试模型，再用其训练，因此模型总是在未见过的样本上接受测试。<sup>[14](http://proceedings.mlr.press/v11/bifet10a/bifet10a.pdf)</sup><sup> • </sup><sup>[1](https://www.cs.put.poznan.pl/dbrzezinski/publications/Stream_Classification.pdf)</sup> 交叉验证和自助法（bootstrapping）被认为对数据流而言代价过高，而传统的“训练—交叉验证—测试”工作流不适用于序列数据，这也使参数调优变得更加困难。<sup>[1](https://www.cs.put.poznan.pl/dbrzezinski/publications/Stream_Classification.pdf)</sup><sup> • </sup><sup>[10](https://www.kdd.org/exploration_files/16-1-2014.pdf)</sup>

评估存在一些已知的陷阱。在 [Electricity](https://www.edgepedia.org/zh/electricity) 数据集上，一个预测前一标签的“无变化”（No-Change）分类器在采用 1000 个样本滑动窗口的序贯评估下，优于增量朴素贝叶斯和 VFDT；一项回顾性调查发现，16 个已发表的流分类器中只有 6 个在该数据集上胜过它。<sup>[15](https://users.ics.aalto.fi/jesse/papers/Pitfalls%20in%20Benchmarking%20Data%20Stream%20Classification%20and%20How%20to%20Avoid%20Them.pdf)</sup> \( \kappa^{+} \) 统计量针对时间依赖性对 Kappa 作了校正；在 Forest Covertype 上，朴素贝叶斯和 VFDT 的 \( \kappa^{+} \) 为负值，而“无变化”分类器得分为零。<sup>[15](https://users.ics.aalto.fi/jesse/papers/Pitfalls%20in%20Benchmarking%20Data%20Stream%20Classification%20and%20How%20to%20Avoid%20Them.pdf)</sup> 在统计比较方面，推荐使用结合威尔科克森符号秩检验（Wilcoxon's signed rank test）的序贯 k 折分布式自助法验证。<sup>[16](http://gdfm.me/assets/media/2010/05/efficient-online-evaluation-of-big-data-stream-classifiers.pdf)</sup> 工具方面：MOA 可在明确的内存限制下对含数千万样本的流进行评估；<sup>[14](http://proceedings.mlr.press/v11/bifet10a/bifet10a.pdf)</sup> Python 库 River 提供 learn_one/predict_one 接口，并带有在线统计、预处理、流水线和渐进式验证功能。<sup>[17](https://github.com/online-ml/river/)</sup>

## 起源

该领域的奠基论文是《挖掘高速数据流》（"Mining high-speed data streams"），其中提出了 VFDT，即极快决策树学习器。<sup>[3](https://doi.org/10.1145/347090.347107)</sup> CVFDT 将其推广到随时间变化的流。<sup>[11](https://dl.acm.org/doi/10.1145/502512.502529)</sup> 《计算与图形统计杂志》（Journal of Computational and Graphical Statistics）2003 年提出的通用框架，将决策树归纳、[贝叶斯网络](https://www.edgepedia.org/zh/bayesian-network)学习、k 均值聚类以及针对高斯混合的 EM 算法推广到大规模流数据。<sup>[4](https://homes.cs.washington.edu/~pedrod/papers/jcgs03.pdf)</sup> 前身工作包括杰弗里·C·施利默（Jeffrey C. Schlimmer）和理查德·H·格兰杰（Richard H. Granger）1986 年发表在《机器学习》（Machine Learning）上的含噪数据增量学习，<sup>[18](https://doi.org/10.1023/a:1022810614389)</sup> 以及格哈德·维德默（Gerhard Widmer）和米罗斯拉夫·库巴特（Miroslav Kubat）1996 年同样发表于《机器学习》的关于存在概念漂移与隐藏上下文时的学习研究。<sup>[19](https://doi.org/10.1023/a:1018046501280)</sup> 霍夫丁树的单遍分裂保证为其赢得了 2015 年 KDD“时间检验奖”（Test of Time award）。<sup>[20](https://ar5iv.labs.arxiv.org/html/2010.08199)</sup>

## 变体

**树的变体。** 霍夫丁树将每次分裂推迟到有把握时才进行，且从不重新审视；而超快决策树（Extremely Fast Decision Tree，HATT/EFDT）则一俟分裂有用即予以部署，并在出现更好备选时重新审视并替换分裂，依概率收敛于批处理树。<sup>[21](https://arxiv.org/pdf/1802.08780.pdf)</sup> 霍夫丁自适应树（Hoeffding Adaptive Tree）在每个节点使用 ADWIN 作为变化检测器和误差估计器，具有理论保证，且不像 CVFDT 那样需要固定参数；它有三个版本：HAT-INC、HAT-EWMA 和 HAT-ADWIN。<sup>[7](http://library.usc.edu.ph/ACM/KKD%202017/pdfs/p1733.pdf)</sup><sup> • </sup><sup>[22](https://www.mdpi.com/2504-4990/7/3/87)</sup>

**集成方法。** ADWIN 装袋法用 ADWIN 实例监控每个基模型，并在检测到漂移时重置最差的分类器；与之同时提出的还有自适应尺寸霍夫丁树（Adaptive-Size Hoeffding Tree，ASHT）装袋法。<sup>[23](https://psycnet.apa.org/doi/10.1145/1557019.1557041)</sup> 自适应随机森林（Adaptive Random Forests）由埃托尔·M·戈麦斯（Heitor M. Gomes）及其同事于 2017 年发表在《机器学习》上，通过局部子空间随机化使随机森林适应流数据；流式随机补丁（Streaming Random Patches）采用全局子空间随机化，从而提高了多样性和整体准确率。<sup>[24](https://doi.org/10.1007/s10994-017-5642-8)</sup><sup> • </sup><sup>[25](https://kdd.org/exploration%5Ffiles/3.%5FCR%5F7.%5FMachine%5Flearning%5Ffor%5Fstreaming%5Fdata%5Fstate%5Fof%5Fthe%5Fart-Final.pdf)</sup> 其他有名称的族系包括 SEA、在线装袋法与提升法，以及反应式加权集成。<sup>[23](https://psycnet.apa.org/doi/10.1145/1557019.1557041)</sup>

**其他任务与近期系统。** 流聚类方法包括 CluStream、Den-Stream、StreamKM++、ClusTree 和 D-Stream；CluStream 可用于异常检测，尽管它依赖一个离线的 k 均值步骤。<sup>[14](http://proceedings.mlr.press/v11/bifet10a/bifet10a.pdf)</sup><sup> • </sup><sup>[25](https://kdd.org/exploration%5Ffiles/3.%5FCR%5F7.%5FMachine%5Flearning%5Ffor%5Fstreaming%5Fdata%5Fstate%5Fof%5Fthe%5Fart-Final.pdf)</sup> 贝叶斯网络可利用霍夫丁界从流中学习；朴素贝叶斯无需适应性调整，因为它以较小的、有界的内存进行增量训练。River 是 Creme 与 scikit-multiflow（后者由雅各布·蒙铁尔（Jacob Montiel）、杰西·里德（Jesse Read）、阿尔伯特·比费特（Albert Bifet）和塔莱勒·阿卜杜萨勒姆（Talel Abdessalem）于 2018 年发布在 arXiv 上）合并而成，<sup>[26](https://doi.org/10.48550/arxiv.1807.04662)</sup> 由雅各布·蒙铁尔及其同事于 2022 年发布，现除 Python 外还支持 Rust。<sup>[27](https://doi.org/10.25455/wgtn.20289144)</sup><sup> • </sup><sup>[17](https://github.com/online-ml/river/)</sup> DeepStreamEnsemble 由洛林·钱伯斯（Lorraine Chambers）、穆罕默德-梅德哈特·加贝尔（Mohamed-Medhat Gaber）和侯赛因·戈梅希（Hossein Ghomeshi）于 2025 年发表在《国际机器学习与控制论杂志》（International Journal of Machine Learning and Cybernetics）上，它将 DNN 隐藏层激活与霍夫丁树集成相结合，用于漂移检测与适应，报告称相较其他十一种方法准确率提升 5–20%。<sup>[13](https://link.springer.com/article/10.1007/s13042-024-02492-x)</sup> 诸如 [TabPFN](https://www.edgepedia.org/zh/tabpfn) 的表格基础模型以恒定内存和线性运行时间将上下文学习引入流处理。<sup>[6](https://arxiv.org/html/2502.16840v2)</sup>

## 应用

VFDT 曾被用于挖掘整个华盛顿大学（University of Washington）主校区持续的 Web 访问数据流，这是早期的一个点击流应用。<sup>[3](https://doi.org/10.1145/347090.347107)</sup> 信用评分是一个有记载的驱动场景：其中“违约”与“未违约”的目标定义会随业务或监管要求而变化；此外还有需要实时分析的传感器生成数据和交易生成数据。<sup>[10](https://www.kdd.org/exploration_files/16-1-2014.pdf)</sup> 更广泛的场景是来自物联网设备和社交网络的持续生成数据。<sup>[2](https://wires.onlinelibrary.wiley.com/doi/10.1002/widm.1405)</sup>

## 局限与替代方案

单纯的 VFDT 方法仅适用于静态流，不包含在概念漂移下遗忘或重启的方法。<sup>[9](https://link.springer.com/article/10.1007/s42452-019-1433-0)</sup> 标签延迟或缺失是一种主要的失效模式：ADWIN 和 EDDM 假设标签立即到达，当真实标签不能立即获得时，其检测能力可能严重下降。<sup>[25](https://kdd.org/exploration%5Ffiles/3.%5FCR%5F7.%5FMachine%5Flearning%5Ffor%5Fstreaming%5Fdata%5Fstate%5Fof%5Fthe%5Fart-Final.pdf)</sup> 类别不平衡是另一个问题：一项对 24 种最先进算法在 515 个不平衡流上的实验研究发现，缺乏标准化的评估程序和基准。<sup>[28](https://dl.acm.org/doi/10.1007/s10994-023-06353-6)</sup> 实现细节很重要：HoeffdingTree/HoeffdingAdaptiveTree 实现中十三个未明确规定的设计决策会显著影响序贯准确率。<sup>[20](https://ar5iv.labs.arxiv.org/html/2010.08199)</sup> 基准稀缺的问题持续存在；最流行的漂移检测数据集是 Electricity，它包含澳大利亚新南威尔士州市场以 30 分钟为间隔的 45,312 个价格。<sup>[9](https://link.springer.com/article/10.1007/s42452-019-1433-0)</sup>

与替代方案的比较：在流算法内部，通过从充分统计量中减去样本以[实现](https://www.edgepedia.org/zh/implementation)遗忘的做法与窗口化相互竞争；对于变化极快的数据，纯窗口化可能仍能产生更好的结果。<sup>[4](https://homes.cs.washington.edu/~pedrod/papers/jcgs03.pdf)</sup> 在线深度学习基于单个样本而非小批量运行，这降低了有效输入维度，并使 GPU 相较 CPU 很少具有优势；一至两层的较小网络更受青睐，因为变换器等较大架构在漂移期间及紧随其后的阶段准确率显著更低。<sup>[29](https://arxiv.org/html/2405.17222v2)</sup>

## References

1. [Stream Classification (Brzezinski, encyclopedia chapter)](https://www.cs.put.poznan.pl/dbrzezinski/publications/Stream_Classification.pdf)
2. [Data stream analysis: Foundations, major tasks and tools (WIREs survey)](https://wires.onlinelibrary.wiley.com/doi/10.1002/widm.1405)
3. [Mining high-speed data streams (Domingos & Hulten, KDD '00)](https://doi.org/10.1145/347090.347107)
4. [A General Framework for Mining Massive Data Streams (Domingos & Hulten, JCGS 2003)](https://homes.cs.washington.edu/~pedrod/papers/jcgs03.pdf)
5. [MOA Manual / Data Stream Mining documentation](https://moa.cms.waikato.ac.nz/wp-content/uploads/2010/05/Manual.pdf)
6. [In-context Learning of Evolving Data Streams with Tabular Foundational Models](https://arxiv.org/html/2502.16840v2)
7. [Extremely Fast Decision Tree Mining for Evolving Data Streams (streamDM-C++, KDD 2017 industry track)](http://library.usc.edu.ph/ACM/KKD%202017/pdfs/p1733.pdf)
8. [Wassily Hoeffding (1963). Probability Inequalities for Sums of Bounded Random Variables. Journal of the American Statistical Association.](https://doi.org/10.1080/01621459.1963.10500830)
9. [Data stream mining: methods and challenges for handling concept drift (Wares, Isaacs, Elyan, SN Applied Sciences, 2019)](https://link.springer.com/article/10.1007/s42452-019-1433-0)
10. [Open Challenges for Data Stream Mining Research (Krempl et al., SIGKDD Explorations 2014)](https://www.kdd.org/exploration_files/16-1-2014.pdf)
11. [Mining time-changing data streams (Hulten, Spencer & Domingos, KDD '01)](https://dl.acm.org/doi/10.1145/502512.502529)
12. [Newer methods for adaptive windowing: ADWIN (Bifet and Gavaldà)](https://www.cs.upc.edu/%7Egavalda/papers/adwin06.pdf)
13. [DeepStreamEnsemble: streaming adaptation to concept drift in deep neural networks (Int. J. of Machine Learning and Cybernetics)](https://link.springer.com/article/10.1007/s13042-024-02492-x)
14. [MOA: Massive Online Analysis, a Framework for Stream Classification and Clustering (Bifet et al., 2010)](http://proceedings.mlr.press/v11/bifet10a/bifet10a.pdf)
15. [Pitfalls in Benchmarking Data Stream Classification and How to Avoid Them (Žliobaitė et al.)](https://users.ics.aalto.fi/jesse/papers/Pitfalls%20in%20Benchmarking%20Data%20Stream%20Classification%20and%20How%20to%20Avoid%20Them.pdf)
16. [Efficient Online Evaluation of Big Data Stream Classifiers](http://gdfm.me/assets/media/2010/05/efficient-online-evaluation-of-big-data-stream-classifiers.pdf)
17. [online-ml/river (GitHub repository)](https://github.com/online-ml/river/)
18. [Jeffrey C. Schlimmer, Richard H. Granger (1986). Incremental Learning from Noisy Data. Machine Learning.](https://doi.org/10.1023/a:1022810614389)
19. [Gerhard Widmer, Miroslav Kubat (1996). Learning in the Presence of Concept Drift and Hidden Contexts. Machine Learning.](https://doi.org/10.1023/a:1018046501280)
20. [Emergent and Unspecified Behaviors in Streaming Decision Trees](https://ar5iv.labs.arxiv.org/html/2010.08199)
21. [Extremely Fast Decision Tree (HATT/EFDT)](https://arxiv.org/pdf/1802.08780.pdf)
22. [AML4S: An AutoML Pipeline for Data Streams (MDPI)](https://www.mdpi.com/2504-4990/7/3/87)
23. [New ensemble methods for evolving data streams (Bifet, Holmes, Pfahringer, Kirkby, Gavaldà, KDD '09)](https://psycnet.apa.org/doi/10.1145/1557019.1557041)
24. [Heitor M. Gomes and colleagues (2017). Adaptive random forests for evolving data stream classification. Machine Learning.](https://doi.org/10.1007/s10994-017-5642-8)
25. [Machine learning for streaming data: state of the art, challenges, and opportunities (Gomes et al., SIGKDD Explorations 2019)](https://kdd.org/exploration%5Ffiles/3.%5FCR%5F7.%5FMachine%5Flearning%5Ffor%5Fstreaming%5Fdata%5Fstate%5Fof%5Fthe%5Fart-Final.pdf)
26. [Montiel, Jacob and colleagues (2018). Scikit-Multiflow: A Multi-output Streaming Framework. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1807.04662)
27. [Montiel, J and colleagues (2022). River: Machine learning for streaming data in python. Research Commons (University of Waikato).](https://doi.org/10.25455/wgtn.20289144)
28. [A survey on learning from imbalanced data streams (Cano & Krawczyk, Machine Learning, 2023)](https://dl.acm.org/doi/10.1007/s10994-023-06353-6)
29. [A Retrospective of the Tutorial on Opportunities and Challenges of Online Deep Learning (ECML PKDD 2023 tutorial)](https://arxiv.org/html/2405.17222v2)

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

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Machine learning and neural computation › Machine learning methods

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/data-stream-mining

English original: https://www.edgepedia.org/data-stream-mining
