# 样本复杂度

**样本复杂度**是学习算法为达到指定精度与指定置信度所需的训练样本数量。在概率近似正确（PAC）框架中，它被写为函数 m(ε, δ)：即最小的样本量，使得在样本随机抽取下以至少 1 − δ 的概率，算法的输出误差至多为 ε（或在不可知设定下，误差至多比类中最佳假设高出 ε）。<sup>[1](https://mlcrypto.mit.edu/course/scribe-notes/lec3_scribe.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 所需的最小样本数 m(ε, δ)，使得以至少 1 − δ 的概率，学到的假设误差至多为 ε（可实现情形），或在类中最佳者误差的 ε 范围内（不可知情形）<sup>[1](https://mlcrypto.mit.edu/course/scribe-notes/lec3_scribe.pdf)</sup> |
| 可实现速率 | m(ε, δ) = Θ((VC(H) + log(1/δ))/ε)，关于 1/ε 线性<sup>[1](https://mlcrypto.mit.edu/course/scribe-notes/lec3_scribe.pdf)</sup> |
| 不可知速率 | m(ε, δ) = Θ((VC(H) + log(1/δ))/ε²)，关于 1/ε 二次<sup>[1](https://mlcrypto.mit.edu/course/scribe-notes/lec3_scribe.pdf)</sup> |
| 刻画参数 | 假设类的 VC 维：一个类是可 PAC 学习的，当且仅当其 VC 维有限<sup>[2](https://www.cs.columbia.edu/~aho/cs3261/Lectures/L22-Introduction_to_PAC_Learning.html)</sup> |
| 达成算法 | 经验风险最小化（ERM），即输出使训练误差最小的假设，可达到不可知速率，但在可实现情形下，若无额外的 log(1/ε) 因子，一般不保证达到最优速率<sup>[1](https://mlcrypto.mit.edu/course/scribe-notes/lec3_scribe.pdf)</sup><sup> • </sup><sup>[12](https://www.jmlr.org/papers/volume17/15-389/15-389.pdf)</sup> |
| 分布自由性 | 该界依赖于 ε、δ 和类 H，而不依赖于数据分布；这被称为分布无关学习<sup>[1](https://mlcrypto.mit.edu/course/scribe-notes/lec3_scribe.pdf)</sup> |
| 起源 | PAC 框架由 Leslie G. Valiant 在《可学习性理论》（“A Theory of the Learnable”）中提出，《ACM 通讯》27(11): 1134–1142 (1984)<sup>[3](https://dblp.org/rec/journals/cacm/Valiant84.html)</sup> |

## PAC 框架中的定义

在 PAC 学习中，样本从标注数据上的未知分布 D 中独立抽取。若对每个精度目标 ε 和失败概率 δ，都存在样本量 m(ε, δ)，使得对每个 H-可实现的分布 D，A(S) 的误差超过 ε 的概率至多为 δ，其中 S 是 m 个样本的样本集，则算法 A 可 PAC 学习假设类 H。<sup>[1](https://mlcrypto.mit.edu/course/scribe-notes/lec3_scribe.pdf)</sup>

不可知变体舍弃了 H 中某个假设能完美分类数据的假设。当完美分类不可能时，学习器与 H 中的最佳假设竞争：它必须以至少 1 − δ 的概率，达到至多 H 中所有 h 的真实误差下确界加 ε 的误差。<sup>[1](https://mlcrypto.mit.edu/course/scribe-notes/lec3_scribe.pdf)</sup> 两个定义的一个显著性质是 m(ε, δ) 不依赖于被学习的分布，这就是该保证被称为分布无关的原因。<sup>[1](https://mlcrypto.mit.edu/course/scribe-notes/lec3_scribe.pdf)</sup>

## VC 维与主要界

对于有限假设类，一个简单的计数论证给出形如 m ≥ (1/ε)(ln |H| + ln(1/δ)) 的样本界：有这么多样本时，任何与训练数据一致的假设以至少 1 − δ 的概率真实误差至多为 ε。<sup>[4](https://muphicafe.in/Courses/Machine%20Learning/ch39)</sup> 这个界对无限类变得无用，因为它随 log |H| 增长。<sup>[2](https://www.cs.columbia.edu/~aho/cs3261/Lectures/L22-Introduction_to_PAC_Learning.html)</sup>

对于无限类，类复杂度的正确度量是 **VC 维**（[Vapnik–Chervonenkis 维](https://www.edgepedia.org/zh/vapnik-chervonenkis-dimension)）。若类 H 能实现某点集所有 2^m 种可能标注，则称该点集被 H 打散；[VC 维](https://www.edgepedia.org/zh/vc-dimension)是可打散集合的最大大小，若存在任意大的可打散集合，则为无限。<sup>[2](https://www.cs.columbia.edu/~aho/cs3261/Lectures/L22-Introduction_to_PAC_Learning.html)</sup> 一个概念类是可 PAC 学习的，当且仅当其 VC 维有限。<sup>[2](https://www.cs.columbia.edu/~aho/cs3261/Lectures/L22-Introduction_to_PAC_Learning.html)</sup>

针对这一参数，样本复杂度被紧密刻画：<sup>[1](https://mlcrypto.mit.edu/course/scribe-notes/lec3_scribe.pdf)</sup>

- **可实现情形：** m(ε, δ) = Θ((VC(H) + log(1/δ))/ε)。
- **不可知情形：** m(ε, δ) = Θ((VC(H) + log(1/δ))/ε²)。

[经验风险最小化](https://www.edgepedia.org/zh/empirical-risk-minimization)，即选择训练误差最小假设的规则，可达到最优不可知速率，但一般不能保证达到最优可实现速率，除非增加一个额外的 log(1/ε) 因子。<sup>[1](https://mlcrypto.mit.edu/course/scribe-notes/lec3_scribe.pdf)</sup><sup> • </sup><sup>[12](https://www.jmlr.org/papers/volume17/15-389/15-389.pdf)</sup> 更详细的陈述给出了最优样本复杂度的匹配上界与下界：在可实现情形下，M(ε, δ) = O((VC(H)/ε) log(1/δ)) 且 M(ε, δ) = Ω(VC(H)/ε + (1/ε) log(1/δ))；在不可知情形下，M(ε, δ) = O((VC(H)/ε²) log²(VC(H)/ε) + (1/ε²) log(1/δ)) 且 M(ε, δ) = Ω(VC(H)/ε² + (1/ε²) log(1/δ))。<sup>[5](https://web.math.princeton.edu/~nalon/PDFS/PCC.pdf)</sup> 若 VC(H) 无限，则该类在两种意义下都不是 PAC 可学习的。<sup>[5](https://web.math.princeton.edu/~nalon/PDFS/PCC.pdf)</sup>

## 解读速率

两种情形在界如何随精度目标缩放上有所不同。在可实现情形下，界与 ε 成反比，因此将容忍误差减半会使样本数加倍；在不可知情形下，界与 ε² 成反比，因此将误差减半需要四倍的样本。在两种情形下，对有限假设空间大小的依赖都仅是对数的。<sup>[6](https://www.cs.cmu.edu/~mgormley/courses/10601-s22/slides/lecture15-pac.pdf)</sup> 对 1/δ 的对数依赖意味着置信度相对便宜，而精度是昂贵的量。

具体类别可以说明这一参数。实数轴上的阈值函数具有 VC 维 1：一个点可以被标为任一标签，但没有阈值能把较小的点标为 1、较大的点标为 0。<sup>[1](https://mlcrypto.mit.edu/course/scribe-notes/lec3_scribe.pdf)</sup> R^d 中的半空间具有 VC 维 d + 1。<sup>[7](https://theorempath.com/topics/vc-dimension)</sup> 不可知界也支撑了一个实践直觉：更复杂的假设空间需要更多数据——样本复杂度随 VC(H) 增长，这是过拟合担忧的定量版本。<sup>[4](https://muphicafe.in/Courses/Machine%20Learning/ch39)</sup>

## 超越二分类 PAC 学习

**其他设定。** 样本复杂度已在强化学习中被研究：对于回合制固定时域马尔可夫决策过程，达到 ε-最优策略所需的回合数在上界中按 Õ(|S|²|A|H²/ε² · ln(1/δ)) 缩放，并有在忽略对数因子和额外一个 |S| 因子意义下匹配的下界。<sup>[8](https://arxiv.org/abs/1510.08906)</sup> 在量子学习理论中，学习算法的量子与经典样本复杂度在 PAC 和不可知模型中均相等，至多差常数因子。<sup>[9](https://arxiv.org/abs/1607.00932)</sup>

**神经网络。** 经典的基于 VC 的界对现代过参数化网络是空洞的，因此近期工作通过其他容量度量来界定样本复杂度。在每层参数矩阵的范数约束下，神经网络的 Rademacher 复杂度界改进了对深度的依赖，并且在额外假设下，完全独立于网络的深度和宽度规模。<sup>[10](https://proceedings.mlr.press/v75/golowich18a.html)</sup>

**压缩。** 样本复杂度与样本压缩方案相关联，后者由 Littlestone 和 Warmuth 提出，他们证明了压缩蕴含 PAC 可学习性，并追问可学习性是否蕴含压缩。是否每个类都有大小为 O(VC-dim(H)) 的样本压缩方案仍是开放问题；已知最好的通用结果是 VC 维的指数级（Yehudayoff 等，2015）。<sup>[11](https://www.cs.toronto.edu/~toni/Courses/CommComplexity2022/Lectures/notes-learning.pdf)</sup>

## References

1. [MIT 6.S976/18.S996 Lecture 3 scribe notes: PAC learning and sample complexity](https://mlcrypto.mit.edu/course/scribe-notes/lec3_scribe.pdf)
2. [Lecture 22: Introduction to PAC Learning, Columbia COMS W3261](https://www.cs.columbia.edu/~aho/cs3261/Lectures/L22-Introduction_to_PAC_Learning.html)
3. [Leslie G. Valiant (1984). A Theory of the Learnable. Commun. ACM 27(11): 1134–1142, dblp record](https://dblp.org/rec/journals/cacm/Valiant84.html)
4. [MuPhi Café, Machine Learning Lecture 39: Computational Learning Theory and Sample Complexity](https://muphicafe.in/Courses/Machine%20Learning/ch39)
5. [PAC Learnability: Proofs and Sample Complexity Bounds (Princeton lecture notes, Appendix C)](https://web.math.princeton.edu/~nalon/PDFS/PCC.pdf)
6. [Matt Gormley, Lecture 15: PAC Learning, 10-301/601 Introduction to Machine Learning, Carnegie Mellon University](https://www.cs.cmu.edu/~mgormley/courses/10601-s22/slides/lecture15-pac.pdf)
7. [VC Dimension: Shattering, Growth Function, TheoremPath](https://theorempath.com/topics/vc-dimension)
8. [Sample Complexity of Episodic Fixed-Horizon Reinforcement Learning, arXiv:1510.08906](https://arxiv.org/abs/1510.08906)
9. [Optimal Quantum Sample Complexity of Learning Algorithms, arXiv:1607.00932](https://arxiv.org/abs/1607.00932)
10. [Golowich, Rakhlin, Shamir (2018). Size-Independent Sample Complexity of Neural Networks, COLT 2018, PMLR 75:297–299](https://proceedings.mlr.press/v75/golowich18a.html)
11. [Communication Complexity and Applications, Lecture 14: sample compression schemes, University of Toronto](https://www.cs.toronto.edu/~toni/Courses/CommComplexity2022/Lectures/notes-learning.pdf)
12. [jmlr.org](https://www.jmlr.org/papers/volume17/15-389/15-389.pdf)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

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

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/sample-complexity

English original: https://www.edgepedia.org/sample-complexity
