← Playground← 놀이터

PRISM · Machine Learning PlaygroundPRISM · 머신러닝 놀이터

Bias–Variance Tradeoff편향–분산 트레이드오프
Underfit vs. overfit — bias², variance, and the U-shaped test error과소적합 vs 과대적합 — 편향², 분산, 그리고 U자형 테스트 오차

degree M = 차수 M = 3 · fits over R = 40 datasets · R = 40개 데이터셋에 대한 적합
true g(x)참 함수 g(x) training data학습 데이터 resampled fits (variance)재샘플링된 적합 (분산) current fit현재 적합 mean fit (its gap to g = bias)평균 적합 (g와의 간격 = 편향)
error decomposition vs. complexity · noise floor σ² = 복잡도에 따른 오차 분해 · 잡음 하한 σ² = 0.040
bias²편향² variance분산 total test error전체 테스트 오차 noise floor σ²잡음 하한 σ² current M현재 M
BIAS²편향²
average fit vs. truth평균 적합 vs 참 함수
at M = M = 3

distance of the average fit from the truth평균 적합이 참 함수에서 벗어난 정도

VARIANCE분산
fit-to-fit spread적합 간 퍼짐
at MM 에서

spread of fits across datasets데이터셋에 따른 적합의 퍼짐

TEST ERROR테스트 오차
bias² + variance + σ²
at MM 에서

U-shaped in M — the minimum is the sweet spotM에 대해 U자형 — 최솟값이 최적 지점

TRAIN ERROR학습 오차
MSE of current fit현재 적합의 MSE
on its data해당 데이터에서

keeps falling as M grows — a poor model selectorM이 커질수록 계속 감소 — 모델 선택 기준으로는 부적절

Formulas수식
$$\mathbb E\big[(y-\hat f(x))^2\big]=\underbrace{\big(\mathbb E[\hat f(x)]-g(x)\big)^2}_{\text{Bias}^2}+\underbrace{\mathbb E\big[(\hat f(x)-\mathbb E[\hat f(x)])^2\big]}_{\text{Variance}}+\underbrace{\sigma^2}_{\text{noise}}$$ $$\mathrm{Bias}(x)=\mathbb E[\hat f(x)]-g(x),\qquad \mathrm{Var}(x)=\mathbb E\big[(\hat f(x)-\mathbb E[\hat f(x)])^2\big]$$ $$\hat{\mathbf w}=(\Phi^\top\Phi)^{-1}\Phi^\top\mathbf y,\qquad \hat f(x)=\hat{\mathbf w}^\top\boldsymbol\phi(x),\qquad \boldsymbol\phi(x)=\big(1,\,x,\,x^2,\dots,x^M\big)$$

Expectations are Monte-Carlo estimates over R resampled training sets, averaged across a dense test grid on [0,1].기댓값은 R개의 재샘플링된 학습셋에 대한 Monte-Carlo 추정치이며, [0,1] 위의 촘촘한 테스트 격자에서 평균을 냅니다.

What to watch관찰 포인트
  1. Small M → high bias, low variance. The fit sits far from g, but the ghosts are tight and almost identical — that is underfitting.M이 작으면 → 편향은 크고 분산은 작음. 적합은 g에서 멀리 떨어져 있지만, 고스트들은 촘촘하고 거의 동일합니다 — 이것이 과소적합입니다.
  2. Large M → low bias, high variance. The ghosts fan out wildly, each one chasing the noise in its own dataset — that is overfitting.M이 크면 → 편향은 작고 분산은 큼. 고스트들이 크게 벌어지며, 각각이 자기 데이터셋의 잡음을 쫓아갑니다 — 이것이 과대적합입니다.
  3. The total test error is U-shaped in M: it falls as bias drops, then rises as variance explodes. Its minimum is the sweet spot.전체 테스트 오차는 M에 대해 U자형입니다. 편향이 줄면서 감소하다가, 분산이 폭발하면서 다시 증가합니다. 그 최솟값이 최적 지점입니다.
  4. Raising N shrinks variance (ghosts tighten) and pushes the sweet spot to higher M; raising σ lifts the whole noise floor σ² and every error with it.N을 늘리면 분산이 줄고(고스트가 좁아짐) 최적 지점이 더 높은 M으로 이동합니다. σ를 늘리면 잡음 하한 σ² 전체가 올라가고 모든 오차도 함께 올라갑니다.