← Playground← 놀이터

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

Support Vector Machine서포트 벡터 머신
Find the maximum-margin boundary — large-margin classification마진이 최대가 되는 경계를 찾아라 — 최대 마진 분류

Training accuracy훈련 정확도
+1 −1 Decision boundary f = 0결정 경계 f = 0 Margin f = ±1마진 f = ±1 SV (on margin, 0<α<C)SV (마진 위, 0<α<C) Margin violation (α = C)마진 위반 (α = C)
MARGIN
Decision boundary결정 경계
‖w‖
Margin마진 2/‖w‖

For RBF, the margin is in feature spaceRBF는 특징공간(feature space)에서의 마진

SUPPORT VECTORS
Points that hold up the boundary경계를 떠받치는 점
On margin (0<α<C)마진 위 (0<α<C)
Violating (α = C)위반 (α = C)

Points with α = 0 don't affect the boundaryα = 0인 점은 경계에 영향 없음

LOSS
Slack and objective슬랙과 목적함수
Σξᵢ (hinge sum)(hinge 합)
½‖w‖² + CΣξ

C is the price of slack (violations)C는 슬랙(위반)의 가격

Formulas수식
$$\min_{\mathbf w,\,b,\,\boldsymbol\xi}\ \tfrac12\|\mathbf w\|^2+C\textstyle\sum_i\xi_i\quad\text{s.t.}\quad y_i\big(\mathbf w^\top\phi(\mathbf x_i)+b\big)\ge 1-\xi_i,\ \ \xi_i\ge0$$ $$\text{margin}=\frac{2}{\|\mathbf w\|},\qquad \xi_i=\max\big(0,\ 1-y_i f(\mathbf x_i)\big)\ \ (\text{hinge})$$ $$\max_{\boldsymbol\alpha}\ \textstyle\sum_i\alpha_i-\tfrac12\sum_{i,j}\alpha_i\alpha_j y_iy_j K(\mathbf x_i,\mathbf x_j)\quad\text{s.t.}\ \ 0\le\alpha_i\le C,\ \ \textstyle\sum_i\alpha_iy_i=0$$ $$f(\mathbf x)=\textstyle\sum_i\alpha_iy_iK(\mathbf x_i,\mathbf x)+b,\qquad K_{\text{RBF}}(\mathbf x,\mathbf z)=e^{-\gamma\|\mathbf x-\mathbf z\|^2}$$ $$\alpha_i=0\ \Leftrightarrow\ \text{outside margin},\qquad 0<\alpha_i
What to watch수업 관찰 포인트
  1. Scan C: On overlapping data, lowering C (≤0.1) widens the margin and allows violations (ξ>0) — a soft margin; raising C approaches a hard margin, and the boundary becomes sensitive to individual points.C 스캔: 겹침 데이터에서 C를 낮추면(≤0.1) 마진이 넓어지고 위반(ξ>0)을 허용하는 soft margin, C를 키우면 hard margin에 접근하며 경계가 개별 점에 민감해진다.
  2. Try dragging a point that is not a support vector (α=0) — the boundary doesn't move at all. Drag a point on the margin and the boundary follows immediately: the solution is determined by just a few SVs (sparsity).서포트 벡터가 아닌 점(α=0)을 드래그해 보라 — 경계가 전혀 안 움직인다. 마진 위의 점을 끌면 경계가 즉시 따라온다: 해는 소수의 SV만으로 결정된다 (sparsity).
  3. On the concentric-circles preset, a linear kernel fails by design. Switch to RBF and a circular boundary appears — γ↑ wraps the boundary around each individual point, overfitting (tiny islands), while γ↓ is nearly linear.동심원 프리셋에서 linear kernel은 원리적으로 실패한다. RBF로 바꾸면 원형 경계가 나온다 — γ↑는 경계가 점 하나하나를 감싸 과적합(작은 섬), γ↓는 거의 선형.
  4. Try adding a single point deep in the opposing camp: with large C the boundary contorts to fit it, while with small C it gives up on that point as slack.반대 진영 깊숙이 점 하나를 추가해 보라: C가 크면 경계가 그 점을 맞추려 뒤틀리고, C가 작으면 그 점을 슬랙으로 포기한다.