docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
@@ -0,0 +1,185 @@
|
||||
---
|
||||
id: wiki-2026-0508-universal-approximation-theorem
|
||||
title: Universal Approximation Theorem
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [UAT, Cybenko Theorem]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.95
|
||||
verification_status: applied
|
||||
tags: [neural-network, theory, approximation, mlp, deep-learning]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: python
|
||||
framework: PyTorch
|
||||
---
|
||||
|
||||
# Universal Approximation Theorem
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 single hidden layer 의 finite-width MLP 가 매 compact subset of ℝⁿ 위 의 매 continuous function 의 arbitrary 정확도 approximation 가능."** Cybenko (1989, sigmoid) · Hornik (1991, general activation) 가 매 정립. 매 existence theorem — 매 width 와 매 trainability 와 매 generalization 은 매 별개. 매 deep learning 의 success 의 explanation 의 X.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 정확한 statement (Hornik 1991)
|
||||
- 매 σ: ℝ → ℝ 가 매 non-constant, bounded, monotonically increasing continuous activation 일 때,
|
||||
- 매 finite sum f(x) = Σᵢ αᵢ σ(wᵢᵀx + bᵢ) 가 매 C(K) (compact K ⊂ ℝⁿ 위 의 continuous function) 의 dense subset.
|
||||
- 즉 매 ε > 0, 매 width N 이 충분히 크면 매 sup|f - g| < ε 의 g 존재.
|
||||
|
||||
### 매 무엇을 의미 (그리고 의미 X)
|
||||
- ✅ **Existence**: 매 충분한 width 의 NN 이 매 함수 의 표현 가능.
|
||||
- ❌ **NOT trainability**: 매 SGD 가 매 그 weight 의 찾을 수 있다는 보장 X.
|
||||
- ❌ **NOT efficiency**: 매 width 가 매 exponential in dimension 일 수 있음.
|
||||
- ❌ **NOT generalization**: 매 train set 의 fit 과 매 test 의 generalize 는 별개.
|
||||
- ❌ **NOT depth necessity**: 매 1 hidden layer 로 충분 — 매 deep 의 정당화 X.
|
||||
|
||||
### 매 variants
|
||||
- **Cybenko 1989**: sigmoid, single hidden layer.
|
||||
- **Hornik 1991**: general non-polynomial activation.
|
||||
- **Leshno 1993**: 매 σ 가 polynomial 이 아니면 충분 — necessary + sufficient.
|
||||
- **Lu et al. 2017 (Deep narrow)**: width n+4 의 ReLU + 매 unbounded depth 가 universal.
|
||||
- **Yarotsky 2017**: 매 deep ReLU 의 매 efficient approximation rate — 매 smooth function 매 exponentially fewer parameter.
|
||||
|
||||
### 매 deep > shallow 의 이유 (UAT 너머)
|
||||
- **Expressivity**: 매 same parameter budget 에서 매 deep 이 매 더 복잡한 function class 를 represent (Telgarsky 2016).
|
||||
- **Optimization landscape**: 매 deep 이 매 SGD 로 매 reachable 한 minimum 의 quality.
|
||||
- **Inductive bias**: 매 hierarchical structure (CNN, Transformer) 가 매 task structure 에 align.
|
||||
|
||||
### 매 응용 (의 한계)
|
||||
1. **연구 정당화**: 매 NN 이 매 표현력 부족 X — 매 아키텍처 search 의 lower bound.
|
||||
2. **교육**: 매 first principle — 매 NN 이 매 universal function approximator.
|
||||
3. ❌ **실무 결정**: 매 UAT 자체로 매 architecture · hyperparameter 결정 X.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### 매 sin(x) 의 1-layer MLP approximation
|
||||
```python
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
import numpy as np
|
||||
|
||||
class SingleLayerMLP(nn.Module):
|
||||
def __init__(self, hidden=200):
|
||||
super().__init__()
|
||||
self.fc1 = nn.Linear(1, hidden)
|
||||
self.fc2 = nn.Linear(hidden, 1)
|
||||
def forward(self, x):
|
||||
return self.fc2(torch.tanh(self.fc1(x)))
|
||||
|
||||
x = torch.linspace(-2*np.pi, 2*np.pi, 1000).unsqueeze(1)
|
||||
y = torch.sin(x)
|
||||
model = SingleLayerMLP(hidden=200)
|
||||
opt = torch.optim.Adam(model.parameters(), lr=1e-2)
|
||||
|
||||
for step in range(5000):
|
||||
pred = model(x)
|
||||
loss = ((pred - y)**2).mean()
|
||||
opt.zero_grad(); loss.backward(); opt.step()
|
||||
print(f"Final MSE: {loss.item():.6f}") # 매 ~1e-5 — 매 UAT 의 empirical 확인
|
||||
```
|
||||
|
||||
### 매 width vs error trade-off
|
||||
```python
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
errors = {}
|
||||
for h in [4, 8, 16, 32, 64, 128, 256, 512]:
|
||||
model = SingleLayerMLP(hidden=h)
|
||||
opt = torch.optim.Adam(model.parameters(), lr=1e-2)
|
||||
for _ in range(3000):
|
||||
loss = ((model(x) - y)**2).mean()
|
||||
opt.zero_grad(); loss.backward(); opt.step()
|
||||
errors[h] = loss.item()
|
||||
plt.loglog(list(errors.keys()), list(errors.values()))
|
||||
# 매 width ↑ → 매 error ↓ 매 polynomial decay
|
||||
```
|
||||
|
||||
### 매 high-dim curse (UAT 의 hidden cost)
|
||||
```python
|
||||
# 매 width 가 매 dimension 에 매 exponential 의 demonstration
|
||||
def required_width(d, target_eps=0.1):
|
||||
# 매 worst-case bound: width ~ (1/eps)^d 의 order
|
||||
return int((1/target_eps) ** d)
|
||||
|
||||
for d in range(1, 11):
|
||||
print(f"d={d}: 매 width ~ {required_width(d):.2e}")
|
||||
# d=10 → 매 10^10 — 매 1-layer 매 impractical
|
||||
```
|
||||
|
||||
### 매 deep narrow (Lu et al.) — width n+4 ReLU 가 universal
|
||||
```python
|
||||
class DeepNarrow(nn.Module):
|
||||
def __init__(self, in_dim=2, depth=20):
|
||||
super().__init__()
|
||||
w = in_dim + 4 # 매 sufficient width
|
||||
self.layers = nn.Sequential(
|
||||
nn.Linear(in_dim, w),
|
||||
*[nn.Sequential(nn.ReLU(), nn.Linear(w, w)) for _ in range(depth)],
|
||||
nn.ReLU(), nn.Linear(w, 1),
|
||||
)
|
||||
def forward(self, x): return self.layers(x)
|
||||
```
|
||||
|
||||
### 매 Yarotsky's smooth function rate
|
||||
```python
|
||||
# 매 C^k function 의 매 deep ReLU NN 매 ε-approximation
|
||||
# 매 parameter count: O(ε^(-d/k) · log(1/ε))
|
||||
# 매 shallow 보다 매 exponentially efficient (k 큼 → big)
|
||||
def yarotsky_params(eps, d, k):
|
||||
import math
|
||||
return int(eps**(-d/k) * math.log(1/eps))
|
||||
print(yarotsky_params(1e-3, 5, 4)) # 매 d=5 dim, k=4 smoothness
|
||||
```
|
||||
|
||||
### 매 UAT 의 empirical demonstration: discontinuous function
|
||||
```python
|
||||
# 매 step function — 매 continuous 가정 violation → 매 UAT 적용 X
|
||||
def step(x): return (x > 0).float()
|
||||
y_step = step(x)
|
||||
model = SingleLayerMLP(hidden=200)
|
||||
opt = torch.optim.Adam(model.parameters(), lr=1e-2)
|
||||
for _ in range(5000):
|
||||
loss = ((model(x) - y_step)**2).mean()
|
||||
opt.zero_grad(); loss.backward(); opt.step()
|
||||
# 매 model 이 매 jump discontinuity 매 smooth 하게 approximate — 매 perfect X
|
||||
# 매 UAT 의 continuous 전제 의 필수
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| 매 architecture 결정 | 매 UAT 로 X — 매 empirical · inductive bias 우선 |
|
||||
| 매 width 의 lower bound 의 search | 매 UAT 의 existence — 매 sufficient 만 보장 |
|
||||
| 매 NN 의 표현력 의 의심 | 매 UAT 가 매 reassurance — 매 충분 width 필요 |
|
||||
| 매 production model | 매 깊이 + 매 inductive bias (CNN, Transformer) 우선 |
|
||||
|
||||
**기본값**: 매 UAT 는 매 educational · theoretical 의 foundation, 매 engineering decision 의 driver X.
|
||||
|
||||
## 🔗 Graph
|
||||
- 변형: [[Cybenko Theorem]]
|
||||
- 응용: [[MLP]]
|
||||
- Adjacent: [[Curse of Dimensionality]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 NN 의 표현력 의 question 에 매 첫 reference — 매 student / interview / paper intro.
|
||||
**언제 X**: 매 specific architecture 의 design 결정 — 매 UAT 의 informational X.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **매 UAT → 매 1-layer 충분**: 매 ignore depth 의 합리화 — 매 efficiency · trainability 의 무시.
|
||||
- **매 UAT → 매 NN 매 무엇이든 학습 가능**: 매 trainability 와 매 generalization 의 conflate.
|
||||
- **매 UAT → 매 large model 정당화**: 매 big-is-better 의 cargo cult.
|
||||
- **매 Width = depth 의 trade-off 의 무시**: 매 deep narrow vs shallow wide — 매 both universal 이지만 매 efficiency 다름.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Cybenko, "Approximation by Superpositions of a Sigmoidal Function", 1989; Hornik 1991; Leshno et al. 1993; Lu et al. 2017; Yarotsky 2017).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — Cybenko/Hornik 정리, deep narrow + Yarotsky variant, 한계 명시 |
|
||||
Reference in New Issue
Block a user