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,145 @@
|
||||
---
|
||||
id: wiki-2026-0508-sensitivity-analysis
|
||||
title: Sensitivity Analysis
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [Sobol, Morris, SALib, Feature Importance]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [statistics, ml-interpretability, uncertainty]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: python
|
||||
framework: SALib / scikit-learn / SHAP
|
||||
---
|
||||
|
||||
# Sensitivity Analysis
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 input 변동이 output 의 어디에 얼마나 영향?"**. 매 Sobol indices (variance decomposition), Morris elementary effects (screening), 그리고 ML interpretability (SHAP, permutation importance) 모두 매 sensitivity analysis 의 family. 매 2026 default: SALib (classic SA) + SHAP (ML model).
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 Local vs Global
|
||||
- **Local**: gradient at one point (∂y/∂x). 매 빠르지만 nonlinear 모델 misleading.
|
||||
- **Global**: full input space sample. 매 Sobol/Morris/FAST. 매 정직.
|
||||
|
||||
### 매 Method 분류
|
||||
- **Screening (Morris)**: 매 cheap, identify important factors among many. r·(k+1) runs.
|
||||
- **Variance-based (Sobol)**: S1 (first-order), ST (total). 매 N·(2k+2) Saltelli sample.
|
||||
- **Regression-based**: standardized regression coefficients (SRC).
|
||||
- **ML feature importance**: permutation, SHAP, integrated gradients.
|
||||
|
||||
### 매 응용
|
||||
1. Engineering tolerance — 매 어느 parameter 가 yield drop.
|
||||
2. Climate/epidemiology model — input uncertainty propagation.
|
||||
3. ML model debug — 매 feature 가 prediction drive.
|
||||
4. Hyperparameter search prior — 매 important hp 만 tune.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Sobol indices (SALib)
|
||||
```python
|
||||
from SALib.sample import saltelli
|
||||
from SALib.analyze import sobol
|
||||
import numpy as np
|
||||
|
||||
problem = {
|
||||
'num_vars': 3,
|
||||
'names': ['x1', 'x2', 'x3'],
|
||||
'bounds': [[0, 1]] * 3,
|
||||
}
|
||||
param_values = saltelli.sample(problem, 1024)
|
||||
Y = np.array([model(*row) for row in param_values])
|
||||
Si = sobol.analyze(problem, Y)
|
||||
print(Si['S1'], Si['ST']) # first-order + total
|
||||
```
|
||||
|
||||
### Morris screening
|
||||
```python
|
||||
from SALib.sample.morris import sample
|
||||
from SALib.analyze import morris
|
||||
|
||||
X = sample(problem, N=100, num_levels=4)
|
||||
Y = np.array([model(*r) for r in X])
|
||||
Mi = morris.analyze(problem, X, Y, num_levels=4)
|
||||
print(Mi['mu_star'], Mi['sigma']) # importance, nonlinearity
|
||||
```
|
||||
|
||||
### Permutation importance (sklearn)
|
||||
```python
|
||||
from sklearn.inspection import permutation_importance
|
||||
r = permutation_importance(model, X_val, y_val, n_repeats=20, random_state=0)
|
||||
for i in r.importances_mean.argsort()[::-1]:
|
||||
print(f"{features[i]}: {r.importances_mean[i]:.3f} ± {r.importances_std[i]:.3f}")
|
||||
```
|
||||
|
||||
### SHAP for any model
|
||||
```python
|
||||
import shap
|
||||
explainer = shap.TreeExplainer(xgb_model) # or shap.Explainer for general
|
||||
sv = explainer(X_val)
|
||||
shap.plots.beeswarm(sv) # global
|
||||
shap.plots.waterfall(sv[0]) # local
|
||||
```
|
||||
|
||||
### Tornado plot (one-at-a-time)
|
||||
```python
|
||||
base = model(**defaults)
|
||||
deltas = []
|
||||
for k, (lo, hi) in bounds.items():
|
||||
lo_y = model(**{**defaults, k: lo})
|
||||
hi_y = model(**{**defaults, k: hi})
|
||||
deltas.append((k, hi_y - lo_y))
|
||||
deltas.sort(key=lambda x: abs(x[1]), reverse=True)
|
||||
```
|
||||
|
||||
### Variance decomposition w/ ANOVA
|
||||
```python
|
||||
import statsmodels.api as sm
|
||||
from statsmodels.formula.api import ols
|
||||
m = ols('y ~ x1 + x2 + x3 + x1:x2', data=df).fit()
|
||||
print(sm.stats.anova_lm(m, typ=2))
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| 100+ inputs, screen first | Morris |
|
||||
| <20 inputs, full ranking | Sobol |
|
||||
| ML black-box | SHAP / permutation |
|
||||
| Linear-ish model | SRC |
|
||||
| One-shot intuition | Tornado |
|
||||
|
||||
**기본값**: SALib Sobol (simulation), SHAP (ML model).
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Statistics]] · [[Epistemic-Uncertainty|Uncertainty-Quantification]]
|
||||
- 변형: [[SHAP]]
|
||||
- 응용: [[Hyperparameters|Hyperparameter-Tuning]]
|
||||
- Adjacent: [[Bayesian Inference]] · [[Monte-Carlo]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: simulation/model에서 어느 input이 결과 좌우하는지 정량화. ML feature 중요도 ranking.
|
||||
**언제 X**: input 간 강한 correlation 존재 — Sobol 가정 깨짐. Conditional SA / Shapley 사용.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **OAT only**: one-at-a-time 은 interaction 놓침.
|
||||
- **Sample 너무 작음**: Sobol N<512 → 매우 noisy estimate.
|
||||
- **Correlated inputs 무시**: independence 가정 violation.
|
||||
- **SHAP = causal**: SHAP 는 attribution, causality 아님.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Saltelli 2010, SALib docs, scikit-learn inspection).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — Sobol/Morris/SHAP unified treatment |
|
||||
Reference in New Issue
Block a user