f8b21af4be
10_Wiki/Topics 대규모 정리: - 오류 캡처/미완성 stub 문서 227개 제거 - 교차폴더 중복 43클러스터 병합 (63파일 → redirect) - 링크명 정규화: 깨진 링크 수정·redirect 직결·개념 매핑 ~2,400건 - 카테고리 MOC 6개 신규 생성 - Graph 섹션 미해결 related-keyword 링크 10,058건 제거 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6.2 KiB
6.2 KiB
id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
| id | title | category | status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | verification_status | tags | raw_sources | last_reinforced | github_commit | tech_stack | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wiki-2026-0508-시뮬레이션과-예측-모델링-simulation-and-pre | 시뮬레이션과 예측 모델링(Simulation and Predictive Modeling) | 10_Wiki/Topics | verified | self |
|
none | A | 0.88 | applied |
|
2026-05-10 | pending |
|
시뮬레이션과 예측 모델링(Simulation and Predictive Modeling)
매 한 줄
"매 closed-form 의 unattainable 의 distribution 의 sampling 의 estimate". 매 Monte Carlo / discrete-event / agent-based 의 3 family — 매 risk pricing, capacity planning, A/B effect 의 forecast 의 backbone. 매 2026 의 PyMC 5, NumPyro, SimPy 4, Mesa 3 의 standard.
매 핵심
매 simulation 3 family
- Monte Carlo: 매 random sampling → integral/expectation 의 estimate. (option pricing, risk VaR.)
- Discrete-event (DES): 매 event timeline 의 advance — queue, server, arrival. (call center, factory.)
- Agent-based (ABM): 매 individual agent + rule + interaction → emergent behavior. (epidemic, market.)
매 predictive modeling vs simulation
- predictive (regression/ML): 매 historical → future point estimate.
- simulation: 매 process model + uncertainty → distribution.
- hybrid: 매 ML predict mean, 매 simulation propagate variance.
매 validation
- 매 backtesting (walk-forward).
- 매 calibration (Brier / reliability diagram).
- 매 sensitivity analysis (Sobol indices).
- 매 convergence check (running mean ± CI).
💻 패턴
Monte Carlo — π estimate
import numpy as np
N = 1_000_000
xy = np.random.uniform(-1, 1, size=(N, 2))
inside = (xy[:,0]**2 + xy[:,1]**2 <= 1).mean()
pi_est = 4 * inside # ~3.1416
European call (Black-Scholes MC)
import numpy as np
S0, K, r, sigma, T, N = 100, 105, 0.05, 0.2, 1.0, 200_000
Z = np.random.standard_normal(N)
ST = S0 * np.exp((r - 0.5*sigma**2)*T + sigma*np.sqrt(T)*Z)
payoff = np.maximum(ST - K, 0)
price = np.exp(-r*T) * payoff.mean()
se = np.exp(-r*T) * payoff.std() / np.sqrt(N) # standard error
Variance reduction — antithetic
half = N // 2
Z = np.random.standard_normal(half)
Z_anti = np.concatenate([Z, -Z])
ST = S0 * np.exp((r - 0.5*sigma**2)*T + sigma*np.sqrt(T)*Z_anti)
# 매 same N, lower variance
Discrete-event (SimPy)
import simpy, random
def customer(env, server):
arrive = env.now
with server.request() as req:
yield req
wait = env.now - arrive
yield env.timeout(random.expovariate(1/3)) # service ~Exp(mean=3)
results.append(wait)
env = simpy.Environment()
server = simpy.Resource(env, capacity=2)
results = []
def arrivals(env):
while True:
yield env.timeout(random.expovariate(1/2)) # arrival ~Exp(mean=2)
env.process(customer(env, server))
env.process(arrivals(env))
env.run(until=1000)
print('avg wait', sum(results)/len(results))
Agent-based (Mesa 3, sketch)
from mesa import Agent, Model
from mesa.time import RandomActivation
class Trader(Agent):
def step(self):
# simple momentum rule
if self.model.price > self.last_price: self.buy()
else: self.sell()
self.last_price = self.model.price
class Market(Model):
def __init__(self, n):
self.schedule = RandomActivation(self)
self.price = 100
for i in range(n): self.schedule.add(Trader(i, self))
def step(self):
self.schedule.step()
# update price by net demand ...
Bayesian forecasting (PyMC 5)
import pymc as pm
with pm.Model() as m:
mu = pm.Normal('mu', 0, 10)
sigma = pm.HalfNormal('sigma', 5)
y = pm.Normal('y', mu=mu, sigma=sigma, observed=data)
trace = pm.sample(2000, tune=1000, chains=4)
with m:
ppc = pm.sample_posterior_predictive(trace, var_names=['y'])
# 매 forecast distribution + uncertainty
Bootstrap CI
import numpy as np
def bootstrap_ci(data, stat=np.mean, B=10_000, alpha=0.05):
boot = [stat(np.random.choice(data, size=len(data), replace=True)) for _ in range(B)]
return np.quantile(boot, [alpha/2, 1-alpha/2])
Sensitivity (Sobol)
from SALib.sample import saltelli
from SALib.analyze import sobol
problem = {'num_vars': 3, 'names': ['x1','x2','x3'],
'bounds': [[0,1]]*3}
X = saltelli.sample(problem, 1024)
Y = np.array([model(*x) for x in X])
Si = sobol.analyze(problem, Y)
print(Si['ST']) # total-order indices
매 결정 기준
| 문제 | Approach |
|---|---|
| Integral / expectation | Monte Carlo |
| Queue / capacity | Discrete-event (SimPy) |
| Heterogeneous actors + interaction | Agent-based (Mesa) |
| Forecasting + uncertainty | Bayesian (PyMC / NumPyro) |
| Calibration / quantification | bootstrap / Sobol |
| 매 large N + GPU | NumPyro (JAX) |
기본값: 매 simple expectation → MC 의 NumPy, 매 queue → SimPy, 매 forecast w/ uncertainty → PyMC 5.
🔗 Graph
- 부모: Statistics · Forecasting
- 변형: Monte Carlo · MCMC
- 응용: Risk Management
- Adjacent: Bayesian_Inference
🤖 LLM 활용
언제: model assumption 의 review, variance reduction 의 propose, sensitivity result 의 interpret. 언제 X: large-scale agent simulation 의 direct execution — specialized engine 의 use.
❌ 안티패턴
- N 의 too small: 매 standard error 의 estimate 의 누락 — running mean check.
- PRNG 의 fixed seed forever: 매 single-path bias — multiple seeds 의 ensemble.
- Closed-form available 의 simulate: 매 unnecessary — analytical solution 의 prefer.
- Calibration 누락: 매 forecast 의 overconfident — Brier/reliability 의 add.
🧪 검증 / 중복
- Verified (Glasserman "Monte Carlo Methods in Financial Engineering", Law "Simulation Modeling and Analysis", PyMC 5 / SimPy 4 docs).
- 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — MC/DES/ABM + PyMC + Sobol 의 정리 |