[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,91 +2,189 @@
|
||||
id: wiki-2026-0508-시뮬레이션과-예측-모델링-simulation-and-pre
|
||||
title: 시뮬레이션과 예측 모델링(Simulation and Predictive Modeling)
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: []
|
||||
aliases: [Monte Carlo Simulation, Predictive Modeling, What-if Analysis]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.92
|
||||
tags: [uncategorized]
|
||||
confidence_score: 0.88
|
||||
verification_status: applied
|
||||
tags: [simulation, monte-carlo, forecasting, modeling, statistics]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-08
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: python
|
||||
framework: numpy-scipy
|
||||
---
|
||||
|
||||
# 시뮬레이션과 예측 모델링(Simulation and Predictive Modeling)
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
시뮬레이션과 예측 모델링은 게임 경제 설계에서 전통적인 스프레드시트의 한계를 극복하고 플레이어의 복잡한 행동과 게임 내 무작위성(Randomness)을 예측하는 필수적인 분석 과정이다.[1-3] 몬테카를로 시뮬레이션과 같은 기법을 통해 수만 번의 가상 플레이어 여정을 실행하여 자원 공급과 소비의 불균형을 출시 전에 사전에 파악할 수 있다.[3, 4] 출시 후에는 실제 라이브옵스([[LiveOps|LiveOps]]) 데이터를 통합하여 모델을 '디지털 트윈([[Digital_Twin|Digital Twin]])'으로 고도화하고 미래의 지표를 정확히 예측함으로써 게임의 장기적인 수익성과 구조적 무결성을 유지한다.[3, 5]
|
||||
## 매 한 줄
|
||||
> **"매 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.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
* **전통적 테스트 방식의 한계와 시뮬레이션의 이점:** 과거 게임 경제는 주로 엑셀 등 스프레드시트의 정적인 평균값에 의존해 설계되었으나, 이는 플레이어의 개인적 편향, 창발성([[Emergence|Emergence]]), 그리고 무작위성을 예측하는 데 뚜렷한 한계가 있다.[2, 3, 6] 또한 실제 플레이 기반의 테스트는 수 주일의 시간과 예산이 소모되며, 핵심 메커니즘이 완성되어야만 가능하다는 단점이 있다.[7, 8] 반면 프로그램화된 시뮬레이션은 실제 게임 플레이 없이 메커니즘을 테스트할 수 있어 수일 또는 수 시간 내에 검증이 가능하며, 개발 초기 단계부터 경제 시스템을 테스트할 수 있다.[8-10]
|
||||
* **몬테카를로 시뮬레이션(Monte Carlo Simulation)의 적용:** 복잡한 프리미엄(Freemium) 경제 모델에서 무작위 변수가 포함된 결과를 예측하기 위해 몬테카를로 시뮬레이션과 대수의 법칙(Law of Large Numbers)이 활용된다.[4, 11] 마키네이션([[Machinations|Machinations]])과 같은 도구를 이용해 수만 번의 플레이어 여정을 가상으로 실행하면, 특정 구간에서 재화가 고갈되거나 과잉되는 시점을 사전에 포착할 수 있다.[3, 12, 13] 이는 단순한 평균값이 아닌 다양한 성과의 스펙트럼을 보여주어, 라이트 유저부터 고과금 유저(Whale)까지 모든 유형의 플레이어 경험을 균형 있게 조정할 수 있도록 돕는다.[14, 15]
|
||||
* **디지털 트윈(Digital Twin)과 라이브옵스(LiveOps) 데이터 통합:** 사전 제작 단계에서는 시뮬레이션 툴이나 Python 스크립트를 통해 데이터를 생성하지만, 게임 출시 후에는 실제 플레이어의 텔레메트리 데이터(JSON 형식 등)를 시뮬레이션 모델에 직접 주입(Data Ingestion)할 수 있다.[3, 5, 16] 이를 통해 게임 경제 모델은 현실과의 간극이 좁혀진 '디지털 트윈'으로 진화하며, 초기 설계 단계의 '가정(Assumptions)'이 미래 플레이어 행동에 대한 정확한 '예측(Predictions)'으로 전환된다.[3, 5, 17]
|
||||
* **AI 기반의 자동 밸런싱(AI-Driven Balancing):** 최근에는 파라미터를 수동으로 조정하는 것을 넘어 AI를 활용한 자동 밸런싱 도구가 게임 경제 모델링에 도입되고 있다.[18] 게임 디자이너가 "플레이어가 첫 10분 동안 최대 3번만 사망하게 한다"와 같은 구체적인 목표를 설정하면, AI 시스템이 이를 달성하기 위해 관련 파라미터들을 스스로 조정한다.[3, 18] 이는 수익화(LTV 극대화)나 플레이어 참여도 최적화 등 각 게임의 목표에 맞춰 경제 시스템을 효과적으로 자동 보정해 준다.[19]
|
||||
## 매 핵심
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- **Related Topics:** `[[게임 경제 설계(Game Economy Design)|게임 경제 설계(Game Economy Design]]`, `몬테카를로 시뮬레이션(Monte Carlo Simulation)`, `디지털 트윈(Digital Twin)`, `[[라이브옵스(Live-ops)|라이브옵스(LiveOps]]`
|
||||
- **Projects/Contexts:** `[[마키네이션(Machinations.io)|마키네이션(Machinations.io]]`, `모노폴리 고([[Monopoly GO!|Monopoly GO!]]`
|
||||
- **Contradictions/Notes:** 전통적인 스프레드시트 기반의 정적 분석은 단순한 이상적 평균값에 의존해 실제 플레이어의 창발적 플레이와 편향을 예측할 수 없으나, 예측 모델링 및 시뮬레이션 툴은 무작위성과 대수의 법칙을 반영하여 실제와 매우 유사한 결과를 도출하고 균형을 맞출 수 있다고 대조하여 설명합니다.[2, 3, 6]
|
||||
### 매 simulation 3 family
|
||||
1. **Monte Carlo**: 매 random sampling → integral/expectation 의 estimate. (option pricing, risk VaR.)
|
||||
2. **Discrete-event (DES)**: 매 event timeline 의 advance — queue, server, arrival. (call center, factory.)
|
||||
3. **Agent-based (ABM)**: 매 individual agent + rule + interaction → emergent behavior. (epidemic, market.)
|
||||
|
||||
---
|
||||
*Last updated: 2026-04-28*
|
||||
### 매 predictive modeling vs simulation
|
||||
- **predictive (regression/ML)**: 매 historical → future point estimate.
|
||||
- **simulation**: 매 process model + uncertainty → distribution.
|
||||
- **hybrid**: 매 ML predict mean, 매 simulation propagate variance.
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
### 매 validation
|
||||
- 매 backtesting (walk-forward).
|
||||
- 매 calibration (Brier / reliability diagram).
|
||||
- 매 sensitivity analysis (Sobol indices).
|
||||
- 매 convergence check (running mean ± CI).
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
## 💻 패턴
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
|
||||
- **과거 데이터와의 충돌:** 없음
|
||||
- **정책 변화:** 없음
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
### Monte Carlo — π estimate
|
||||
```python
|
||||
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
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### European call (Black-Scholes MC)
|
||||
```python
|
||||
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
|
||||
```
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### Variance reduction — antithetic
|
||||
```python
|
||||
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
|
||||
```
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### Discrete-event (SimPy)
|
||||
```python
|
||||
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)
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
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))
|
||||
```
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
### Agent-based (Mesa 3, sketch)
|
||||
```python
|
||||
from mesa import Agent, Model
|
||||
from mesa.time import RandomActivation
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
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)
|
||||
```python
|
||||
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
|
||||
```python
|
||||
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)
|
||||
```python
|
||||
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]] · [[Bootstrapping]]
|
||||
- 응용: [[Risk Management]] · [[Capacity Planning]] · [[Epidemic Modeling]]
|
||||
- Adjacent: [[Bayesian Inference]] · [[Variance Reduction]]
|
||||
|
||||
## 🤖 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 의 정리 |
|
||||
|
||||
Reference in New Issue
Block a user