# 边界分类器

边界分类器是一种分类模型，其决策规则以边界来表述——即数据点与其用于分隔类别的决策边界之间的带符号距离（或经过缩放的得分）。最著名的例子是最大边界分类器，它是支持向量机（SVM）的线性可分前身，选择使到最近训练点距离最大的分隔超平面<sup>[1](https://see.stanford.edu/materials/aimlcs229/transcripts/MachineLearning-Lecture06.html)</sup>。边界思想同样构成了提升法、逻辑回归和深度网络泛化分析的基础，在这些分析中，误差界通过分类器在训练数据上取得的边界来表达<sup>[2](https://proceedings.mlr.press/v119/gronlund20a/gronlund20a.pdf)</sup>。

| 关键事实 | 详情 |
|---|---|
| 函数边界 | 对于标签为 ±1 的训练样本 (x⁽ⁱ⁾, y⁽ⁱ⁾)，γ̂⁽ⁱ⁾ = y⁽ⁱ⁾(wᵀx⁽ⁱ⁾ + b)；通过缩放 w 和 b 可以使其任意增大<sup>[3](https://gocourseversity.com/lesson/support-vector-machines-and-kernel-methods/)</sup> |
| 几何边界 | γ⁽ⁱ⁾ = y⁽ⁱ⁾((w/‖w‖)ᵀx⁽ⁱ⁾ + b/‖w‖)，即该点到决策边界的重缩放不变欧几里得距离<sup>[3](https://gocourseversity.com/lesson/support-vector-machines-and-kernel-methods/)</sup> |
| 支持向量 | 最靠近边界的训练点；它们单独决定了决策边界，模型的决策函数仅依赖于这个子集<sup>[4](https://scikit-learn.org/stable/modules/svm.html)</sup> |
| 关键论文 | Vapnik 与 Lerner 的广义肖像（1963）；Boser、Guyon 与 Vapnik 的最优边界分类器算法（COLT 1992）；Cortes 与 Vapnik 的软边界扩展（1995）<sup>[5](https://www.mathnet.ru/php/archive.phtml?jrnid=at&option_lang=eng&paperid=11885&wshow=paper)</sup><sup> • </sup><sup>[6](https://cir.nii.ac.jp/crid/1363388846207915264)</sup><sup> • </sup><sup>[7](https://doi.org/10.1007/bf00994018)</sup> |
| 泛化界 | 当所有边界至少为 θ、数据半径为 R 时，测试误差的上界为 O((R/θ)² ln²m + ln(1/δ))/m，与数据维度无关<sup>[2](https://proceedings.mlr.press/v119/gronlund20a/gronlund20a.pdf)</sup> |
| 实践提示 | 基于边界的 SVM 算法不具有尺度不变性，因此建议在训练前进行特征缩放<sup>[4](https://scikit-learn.org/stable/modules/svm.html)</sup> |

## 函数边界与几何边界

边界概念形式化了一种直觉：分类器不仅应当正确，还应当自信。在逻辑回归中，当 θᵀx 很大且为正时，y = 1 的预测更加自信；一个好的拟合应当使每个训练样本的 θᵀx⁽ⁱ⁾ 在正确一侧远离零<sup>[8](https://see.stanford.edu/materials/aimlcs229/cs229-notes3.pdf)</sup>。

对于参数为 w 和 b、标签为 y ∈ {−1, 1} 的线性分类器，样本的函数边界为 γ̂⁽ⁱ⁾ = y⁽ⁱ⁾(wᵀx⁽ⁱ⁾ + b)。当且仅当样本被正确分类时它为正，值越大表示置信度越高。训练集的函数边界是各样本中的最小值。其弱点在于尺度：将 w 和 b 乘以任意正常数会将函数边界乘以相同的常数，而分类器本身完全不变<sup>[3](https://gocourseversity.com/lesson/support-vector-machines-and-kernel-methods/)</sup>。

几何边界通过除以 ‖w‖ 消除了这种模糊性，给出 γ⁽ⁱ⁾ = y⁽ⁱ⁾((w/‖w‖)ᵀx⁽ⁱ⁾ + b/‖w‖)，它等于该点到超平面 wᵀx + b = 0 的实际[欧几里得距离](https://www.edgepedia.org/zh/euclidean-distance)。若 ‖w‖ = 1，两种边界重合。训练集的几何边界是各样本中的最小值，而最大边界所要最大化的正是这个量<sup>[3](https://gocourseversity.com/lesson/support-vector-machines-and-kernel-methods/)</sup><sup> • </sup><sup>[9](https://www.math.purdue.edu/~adebray/lecture_notes/229notes.pdf)</sup>。

## 最优边界分类器

当类别线性可分时，无穷多个超平面都能将它们分开，因此需要额外的准则来选取一个<sup>[10](https://web.stanford.edu/class/stats202/notes/Support-vector-machines/Margin.html)</sup>。最大边界分类器——[Andrew Ng](https://www.edgepedia.org/zh/andrew-ng) 在斯坦福 CS229 课程讲义中将其描述为支持向量机的前身——选择使训练集几何边界最大的参数 w 和 b<sup>[1](https://see.stanford.edu/materials/aimlcs229/transcripts/MachineLearning-Lecture06.html)</sup>。

由于缩放 w 和 b 是自由的，问题可以写成规范形式：要求每个样本的函数边界至少为 1，至少有一个点取等号，并最小化 ‖w‖。这产生了一个凸二次规划问题，具有凸二次目标和仅含线性约束，可用标准二次规划代码求解<sup>[11](https://cs229.stanford.edu/notes2020spring/cs229-notes3.pdf)</sup><sup> • </sup><sup>[12](https://nlp.stanford.edu/IR-book/html/htmledition/support-vector-machines-the-linearly-separable-case-1.html)</sup>。所得分类器以尽可能宽的间隔将正负训练样本分开<sup>[13](https://cs229.stanford.edu/summer2022/cs229-notes3.pdf)</sup>。

相关支持向量分类器的名称是字面意义上的：边界由位于边界上或边界内的点所支撑，而非同等依赖于每个观测<sup>[14](https://quidproquo.cc/posts/ai/2026-08-22-stanford-cs229-2026-notes-chapter-06-support-vector-machines-en/)</sup>。在拟合模型中，决策函数仅依赖于这个称为支持向量的训练点子集，这也使模型具有内存效率<sup>[4](https://scikit-learn.org/stable/modules/svm.html)</sup>。

## 从边界到支持向量机

边界思想有着悠久的渊源。1963年，V. N. Vapnik 和 A. Ya. Lerner 发表了基于寻找他们所称的模式广义肖像的模式识别算法<sup>[5](https://www.mathnet.ru/php/archive.phtml?jrnid=at&option_lang=eng&paperid=11885&wshow=paper)</sup>；Vapnik 和 A. Ya. Chervonenkis 从1962年到1971年发展了用于模式识别的广义肖像方法；支持向量机理论后来在此基础上建立<sup>[15](https://www.ipu.ru/en/node/74413)</sup>。

1992年的论文《最优边界分类器的训练算法》，作者为 Bernhard E. Boser（加州大学伯克利分校）、Isabelle M. Guyon（AT&T 贝尔实验室）和 Vladimir N. Vapnik（AT&T 贝尔实验室），发表于第五届 ACM 计算学习理论年度研讨会论文集，第144–152页<sup>[6](https://cir.nii.ac.jp/crid/1363388846207915264)</sup>。其技术适用于多种分类函数，包括感知机、多项式函数和径向基函数<sup>[16](https://oamonitor.ireland.openaire.eu/rfo/sfi_rfo/search/publication?pid=10.1145%2F130385.130401)</sup>。

1995年，Corinna Cortes 和 [Vladimir Vapnik](https://www.edgepedia.org/zh/vladimir-vapnik)（当时均在新泽西州霍姆德尔的 AT&T 贝尔实验室）在《机器学习》（第20卷，第273–297页）上发表了《支持向量网络》。支持向量网络将输入向量非线性地映射到非常高维的特征空间，并在那里构造线性决策面；早期的最大边界思想仅针对可分数据实现，而该论文将其扩展到不可分的训练数据<sup>[7](https://doi.org/10.1007/bf00994018)</sup>。同一论文表明，二次规划可以重新表述为对偶问题，其对偶目标仅通过成对内积 ⟨x⁽ⁱ⁾, x⁽ʲ⁾⟩ 依赖于数据，这正是核方法得以实现的原因<sup>[3](https://gocourseversity.com/lesson/support-vector-machines-and-kernel-methods/)</sup>。

## 大边界为何能泛化

边界分类器的理论吸引力在于其误差界依赖于边界而非数据维度。Bartlett 和 Shawe-Taylor（1999）证明了：若对于 ‖w‖ ≤ 1 的分类器，在半径为 R 的数据上所有训练边界至少为 θ > 0，则以至少 1 − δ 的概率（对 m 个样本），测试误差至多为 O((R/θ)² ln²m + ln(1/δ))/m；其软边界版本增加了一个涉及边界低于 θ 的训练点比例的项。Bartlett 和 Mendelson（2002）利用[拉德马赫复杂度](https://www.edgepedia.org/zh/rademacher-complexity)将软边界形式改进为 O(√((R/θ)² + ln(1/δ))/m)<sup>[2](https://proceedings.mlr.press/v119/gronlund20a/gronlund20a.pdf)</sup>。这些界解释了为什么 SVM 即使使用映射到无穷维空间的高斯核，在实践中也能很好地泛化<sup>[2](https://proceedings.mlr.press/v119/gronlund20a/gronlund20a.pdf)</sup>。

经典界在近二十年间未被改进，直到后来出现了改进。Grønlund 及其同事（2020）给出了一个将硬边界形式改进一个对数因子的界，并证明其在一系列参数下是紧的<sup>[2](https://proceedings.mlr.press/v119/gronlund20a/gronlund20a.pdf)</sup>。

边界分析超越了 SVM。许多分类算法，包括 SVM、提升法和逻辑回归，都最小化 0–1 损失的一个凸替代函数，基于边界的界适用于这一族算法<sup>[17](https://proceedings.neurips.cc/paper/2003/file/5dec707028b05bcbd3a1db5640f842c5-Paper.pdf)</sup>。在提升法中，Schapire、Freund、Bartlett 和 Lee（1998）以边界分布为尺度界定了投票分类器的泛化误差，这成为解释 AdaBoost 在训练误差达到零后为何仍持续改进的标准解释。Breiman（1999）用 arc-gv 算法对此提出挑战，该算法产生比 AdaBoost 更高的边界分布但表现更差；后来的分析将 arc-gv 较差的表现归因于其选择的基分类器复杂度增加，这一发现与边界理论一致<sup>[18](https://doi.org/10.1145/1143844.1143939)</sup>。后续工作通过第 k 边界界和平衡边界进一步完善了这一图景，表明边界分布——而非仅最小边界——预测泛化<sup>[19](https://www.sciencedirect.com/science/article/pii/S0004370213000684)</sup>。

近期理论将边界分析扩展到新的场景。提升方法和线性模型上的坐标下降在高维可分情形下收敛到最大 ℓ₁ 边界分类器，也称为稀疏硬边界 SVM；2024年的工作证明了该分类器的紧预测误差界为 ‖w*‖₁^{2/3}/n^{1/3} 量级，并表明当其插值噪声数据时会出现良性过拟合<sup>[20](https://proceedings.mlr.press/v237/stojanovic24a.html)</sup>。对于深度网络，在多层测量的边界分布与 CIFAR-10 和 CIFAR-100 上的泛化差距强烈相关<sup>[21](https://research.google/pubs/a-margin-based-measure-of-generalization-for-deep-networks/)</sup>，尽管一致收敛论证——包括边界界——已被证明在某些过参数化设置中必然是空洞的，而在这些设置中经 SGD 训练的模型仍然能够泛化<sup>[22](https://www.theorempath.com/papers/uniform-convergence-deep-learning)</sup>。

## 实践应用

边界分类器主要通过 SVM 实现进入实践。在 scikit-learn 中，正则化参数 C 在训练样本的误分类与决策面的简单性之间进行权衡：较低的 C 给出更平滑的决策面，较高的 C 旨在正确分类所有训练样本，C = 1 是合理的默认值，对于噪声数据建议使用较低的值。使用径向基函数核时，参数 gamma 控制单个训练样本的影响范围。由于 SVM 算法不具有尺度不变性，训练前应将特征缩放到如 [0, 1] 的范围，或标准化为零均值和单位方差<sup>[4](https://scikit-learn.org/stable/modules/svm.html)</sup>。

SVM 不直接产生概率估计；当需要概率时，通过 Platt 缩放获得，即对 SVM 得分进行逻辑回归，并通过额外的交叉验证拟合，这对大型数据集代价高昂，且可能产生与原始得分不一致的估计<sup>[4](https://scikit-learn.org/stable/modules/svm.html)</sup>。SVM 训练的核心是二次规划问题，基于 libsvm 的求解器的计算复杂度随缓存使用情况而异，介于 O(n_features × n_samples²) 与 O(n_features × n_samples³) 之间，而线性实现可以几乎线性地扩展到数百万样本<sup>[4](https://scikit-learn.org/stable/modules/svm.html)</sup>。

## References

1. [Stanford Engineering Everywhere, CS229 Lecture 6 transcript: Optimal Margin Classifier](https://see.stanford.edu/materials/aimlcs229/transcripts/MachineLearning-Lecture06.html)
2. [Grønlund, K., et al. (2020). Near-Tight Margin-Based Generalization Bounds for Support Vector Machines. PMLR 119.](https://proceedings.mlr.press/v119/gronlund20a/gronlund20a.pdf)
3. [Support Vector Machines and Kernel Methods, Courseversity lesson](https://gocourseversity.com/lesson/support-vector-machines-and-kernel-methods/)
4. [scikit-learn 1.9.1 documentation: Support Vector Machines](https://scikit-learn.org/stable/modules/svm.html)
5. [Vapnik, V. N., Lerner, A. Ya. (1963). Recognition of Patterns with help of Generalized Portraits. Avtomat. i Telemekh. 24:6, 774–780.](https://www.mathnet.ru/php/archive.phtml?jrnid=at&option_lang=eng&paperid=11885&wshow=paper)
6. [Boser, B. E., Guyon, I. M., Vapnik, V. N. (1992). A Training Algorithm for Optimal Margin Classifiers. COLT 1992, 144–152.](https://cir.nii.ac.jp/crid/1363388846207915264)
7. [Cortes, C., Vapnik, V. (1995). Support-vector networks. Machine Learning 20, 273–297.](https://doi.org/10.1007/bf00994018)
8. [Andrew Ng, CS229 Lecture Notes, Part V: Support Vector Machines](https://see.stanford.edu/materials/aimlcs229/cs229-notes3.pdf)
9. [Purdue CS 229 lecture notes](https://www.math.purdue.edu/~adebray/lecture_notes/229notes.pdf)
10. [Stanford STATS 202: Margins and separating hyperplanes](https://web.stanford.edu/class/stats202/notes/Support-vector-machines/Margin.html)
11. [CS229 Lecture Notes (2020 Spring), Support Vector Machines](https://cs229.stanford.edu/notes2020spring/cs229-notes3.pdf)
12. [Introduction to Information Retrieval: SVMs, the linearly separable case](https://nlp.stanford.edu/IR-book/html/htmledition/support-vector-machines-the-linearly-separable-case-1.html)
13. [CS229 Lecture Notes (2022 Summer)](https://cs229.stanford.edu/summer2022/cs229-notes3.pdf)
14. [CS229 2026 notes, Chapter 6: Support vector machines](https://quidproquo.cc/posts/ai/2026-08-22-stanford-cs229-2026-notes-chapter-06-support-vector-machines-en/)
15. [Vladimir N. Vapnik, Institute of Control Sciences, Russian Academy of Sciences](https://www.ipu.ru/en/node/74413)
16. [OpenAIRE record: A training algorithm for optimal margin classifiers](https://oamonitor.ireland.openaire.eu/rfo/sfi_rfo/search/publication?pid=10.1145%2F130385.130401)
17. [Large Margin Classifiers: Convex Loss, Low Noise, and Convergence Rates. NeurIPS 2003.](https://proceedings.neurips.cc/paper/2003/file/5dec707028b05bcbd3a1db5640f842c5-Paper.pdf)
18. [How boosting the margin can also boost classifier complexity. ICML 2006.](https://doi.org/10.1145/1143844.1143939)
19. [Gao, W., Zhou, Z.-H. (2013). On the doubt about margin explanation of boosting. Artificial Intelligence 203, 1–18.](https://www.sciencedirect.com/science/article/pii/S0004370213000684)
20. [Stojanovic, S., Donhauser, K., Yang, F. (2024). Tight bounds for maximum ℓ₁-margin classifiers. ALT 2024, PMLR 237:1055–1112.](https://proceedings.mlr.press/v237/stojanovic24a.html)
21. [Jiang, Y., et al. (2019). A Margin-Based Measure of Generalization for Deep Networks. ICLR 2019.](https://research.google/pubs/a-margin-based-measure-of-generalization-for-deep-networks/)
22. [Nagarajan, V., Kolter, J. Z. (2019). Uniform Convergence May Be Unable to Explain Generalization in Deep Learning. NeurIPS 2019.](https://www.theorempath.com/papers/uniform-convergence-deep-learning)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; 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 › Generalization bounds

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/margin-classifier

English original: https://www.edgepedia.org/margin-classifier
