← Back to AI Math Mind Map
📐 AI MathID: bias-variance

Bias-Variance Decomposition

偏差方差分解
🎯Core Definition
The bias-variance decomposition splits expected squared test error into three terms: EGE=Bias2+Var+σ2\text{EGE} = \text{Bias}^2 + \text{Var} + \sigma^2. Assume the true relation y=f∗(x)+ϵy = f^*(x) + \epsilon with E[ϵ]=0\mathbb{E}[\epsilon] = 0, Var(ϵ)=σ2\text{Var}(\epsilon) = \sigma^2, and ϵ\epsilon independent of the input; the model f^\hat f is fit on a random training set DD, and fˉ(x)=ED[f^(x)]\bar f(x) = \mathbb{E}_D[\hat f(x)]. Full proof (for fixed xx): rewrite y−f^=ϵ+(f∗−f^)y - \hat f = \epsilon + (f^* - \hat f) and expand: E[(y−f^)2]=E[ϵ2]+2E[ϵ(f∗−f^)]+E[(f∗−f^)2]\mathbb{E}[(y - \hat f)^2] = \mathbb{E}[\epsilon^2] + 2\mathbb{E}[\epsilon(f^* - \hat f)] + \mathbb{E}[(f^* - \hat f)^2]. The cross term vanishes because ϵ\epsilon is independent of the training set DD (hence of f^\hat f) and E[ϵ]=0\mathbb{E}[\epsilon] = 0: 2E[ϵ(f∗−f^)]=2E[ϵ]E[f∗−f^]=02\mathbb{E}[\epsilon(f^* - \hat f)] = 2\mathbb{E}[\epsilon]\mathbb{E}[f^* - \hat f] = 0. For the third term, write f∗−f^=(f∗−fˉ)+(fˉ−f^)f^* - \hat f = (f^* - \bar f) + (\bar f - \hat f); under ED\mathbb{E}_D the cross term 2(f∗−fˉ)ED[fˉ−f^]=2(f∗−fˉ)(fˉ−fˉ)=02(f^* - \bar f)\mathbb{E}_D[\bar f - \hat f] = 2(f^* - \bar f)(\bar f - \bar f) = 0, so ED[(f∗−f^)2]=(f∗−fˉ)2+ED[(f^−fˉ)2]=Bias2+Var\mathbb{E}_D[(f^* - \hat f)^2] = (f^* - \bar f)^2 + \mathbb{E}_D[(\hat f - \bar f)^2] = \text{Bias}^2 + \text{Var}. Combining: EGE=Bias2+Var+σ2\text{EGE} = \text{Bias}^2 + \text{Var} + \sigma^2, where σ2\sigma^2 is irreducible noise that no model can remove.
💡Use Cases
the standard framework for interview questions on why complex models overfit/underfit: more complexity lowers bias (hypothesis space covers the truth) but raises variance (more sensitive to the training set); it also explains bagging (reduces variance), boosting (reduces bias) and regularization (raises bias, lowers variance).
⚡Key Problems Solved
a quantitative diagnosis for capacity selection: low training error with high test error → variance-dominated → add data / regularization / bagging; high error on both → bias-dominated → add capacity / features. Notes: the decomposition holds per fixed xx and is typically averaged over the input distribution; it does not hold for classification under 0-1 loss, where decomposable alternatives like the Brier score are used.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of Bias-Variance Decomposition.
Use Cases
In production engineering, what are the primary use cases for Bias-Variance Decomposition and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Whiteboard-prove E[(y−f^)2]=Bias2+Var+σ2\mathbb{E}[(y-\hat f)^2] = \text{Bias}^2 + \text{Var} + \sigma^2: show the expansion and both cross-term cancellations (E[ϵ]=0\mathbb{E}[\epsilon] = 0 and ED[f^]=fˉ\mathbb{E}_D[\hat f] = \bar f).
2
Why is the cross term 2E[ϵ(f∗−f^)]2\mathbb{E}[\epsilon(f^* - \hat f)] zero? Which independence/expectation assumptions does it rely on? Why is σ2\sigma^2 irreducible?
3
As model complexity grows, how do Bias and Var change? Which term dominates in underfitting vs overfitting?
4
Explain via the decomposition: why does bagging mainly reduce variance, and boosting mainly reduce bias?
5
Why does the decomposition fail for classification with 0-1 loss? What alternative (e.g. Brier score) can be used?
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "Bias-Variance Decomposition"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardRegularization GeometryNext Card →Double Descent

🔗 More AI Math Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/Math/card/bias-variance
中文速览与面试要点

偏差方差分解 (Bias-Variance Decomposition)

定义: 偏差-方差分解把测试均方误差拆成三项: EGE = Bias^2 + Var + ^2。设真实关系 y = f^*(x) + ,其中 E[ ] = 0、 Var( ) = ^2 且 与输入独立;模型 f 在随机训练集 D 上拟合,定义 f(x) = E_D[ f(x)]。完整证明(对固定 x): 先改写误差 y - f = (f^* + ) - f = + (f^* - f),展开平方: E[(y - f)^2] = E[ ^2] + 2 E[ (f^* - f)] + E[(f^* - f)^2]。交叉项消去: 独立于训练集 D(从而独立于 f)且 E[ ] = 0,故 2 E[ (f^* - f)] = 2 E[ ] E[f^* - f] = 0。第三项再展开: 在 f^* - f = (f^* - f) + ( f - f) 上取 E_D,交叉项 2(f^* - f) E_D[ f - f] = 2(f^* - f)( f - f) = 0,于是 E_D[(f^* - f)^2] = (f^* - f)^2 + E_D[( f - f)^2] = Bias^2 + Var。合并三项得 EGE = Bias^2 + Var + ^2,其中 ^2 为不可约噪声,任何模型都无法降低。 使用场景: 面试“为什么复杂模型过拟合/欠拟合”的标准框架: 模型越复杂,偏差越低(假设空间覆盖真实函数的能力强)、方差越高(对训练集的敏感度大);也用于解释 bagging(降方差)、boosting(降偏差)、正则化(增偏差降方差)。 解决的问题: 提供模型容量选择的定量诊断: 训练误差低而测试误差高 → 方差主导 → 加数据/正则化/bagging;训练测试都高 → 偏差主导 → 增加容量/特征。注意: 分解对每个固定 x 成立,一般再对输入分布取期望;对分类问题(0-1 损失)分解不成立,需用 Brier 分数等可分解的替代。

核心要点

  • 白板证明 E[(y- f)^2] = Bias^2 + Var + ^2:写出展开、两次交叉项消去( E[ ] = 0 与 E_D[ f] = f)的每一步。
  • 交叉项 2 E[ (f^* - f)] 为什么为 0?依赖哪些独立性/期望假设?噪声 ^2 为什么不可约?
  • 模型复杂度增大时 Bias 与 Var 各自如何变化?欠拟合与过拟合分别由哪一项主导?
  • 用分解式解释: bagging 为什么主要降方差?boosting 为什么主要降偏差?
  • 该分解对分类(0-1 损失)为什么不成立?可以用什么替代(Brier score)?