M2-027M2: Classical Machine Learning集成方法 (Bagging/RF)Easy
Mastery:

集成方法 (Bagging/RF): 比较 Bagging 与 Boosting 的核心差异。

📐 Mathematical Definition
Bagging: f^=1B∑bfb;Boosting: f^=∑tαtht\text{Bagging}:\ \hat f=\frac1B\sum_b f_b;\quad \text{Boosting}:\ \hat f=\sum_t\alpha_t h_t
⚡ Executive Summary
Core Concept: Bagging 并行训练独立模型降方差;Boosting 串行拟合残差降偏差。

📌 Key Takeaways

  • •
    Bagging 对高方差模型有效(深树)
  • •
    Boosting 对高偏差模型有效(浅树)

📐 Mathematical Derivations

四个维度的对比:① <strong>训练方式</strong>——Bagging 并行(各基学习器独立),Boosting 串行(每个依赖前一个的残差);② <strong>作用目标</strong>——Bagging 降低<strong>方差</strong>(平均独立同分布估计使方差 ∝1/B),Boosting 降低<strong>偏差</strong>(逐步逼近真函数);③ <strong>基学习器要求</strong>——Bagging 需高方差低偏差(深树),Boosting 需低方差高偏差(浅树/决策桩);④ <strong>样本权重</strong>——Bagging 用等权 bootstrap 采样,Boosting 按错误率调整样本权重(AdaBoost)或拟合负梯度(GBDT)。<strong>为什么 Bagging 不能显著降偏差</strong>:平均多个<strong>同偏</strong>的估计不能消除偏差(偏差是系统性的,平均后仍在);而方差因为各估计的独立性被平均掉。反之 Boosting 的串行纠错使整体偏差持续下降,但对噪声敏感——因为噪声样本会被反复赋予高权重,模型不断拟合噪声。

🏭 Production Trade-offs

实践选择与融合:① <strong>数据/模型特性</strong>——若单模型已过拟合(高方差),用 Bagging/RF;若单模型欠拟合(高偏差,如线性模型),用 Boosting。② <strong>对噪声的鲁棒性</strong>——Bagging 更鲁棒(bootstrap 平均抑制噪声),Boosting 需调学习率、子采样(stochastic gradient boosting)、或早停来抑制噪声拟合。③ <strong>计算与并行</strong>——Bagging 天然并行、易扩展;Boosting 串行但有优化(XGBoost 的列并行、LightGBM 的直方图)。④ <strong>现代实践</strong>——GBDT 系(XGBoost/LightGBM/CatBoost)在表格数据上通常最强,RF 作为快速稳健的基线;两者可 Stacking 融合。⑤ <strong>偏差-方差的统一视角</strong>——Bagging 与 Boosting 是同一权衡的两个方向,实践中也可用 <strong>Bagged Boosting</strong>(对 GBDT 做 Bagging)同时降方差与偏差。
⚠️ Common Interview Pitfalls
  • ✕
    认为 Bagging 能降低偏差
  • ✕
    在噪声大的数据上直接用 Boosting 而不做正则
🎯 Interviewer Follow-ups
  • ?
    为什么 Bagging 不能显著降偏差?
  • ?
    为什么 Boosting 对噪声敏感?
📚

Associated Knowledge Base Guides & Mindmaps

Explore the comprehensive technical article, exam cards, and global architecture tree.

← PreviousM2-026: Decision Trees: 如何处理缺失值与类别特征?对比常见做法。📋Back to BankNext →M2-028: 集成方法 (Bagging/RF): 随机森林的两个随机性来源是什么?各自作用。