9148c358d0
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 폴더 제거.
5.3 KiB
5.3 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-bayesian-updating | Bayesian Updating | 10_Wiki/Topics | verified | self |
|
none | A | 0.95 | applied |
|
2026-05-10 | pending |
|
Bayesian Updating
매 한 줄
"매 Posterior ∝ Likelihood × Prior — evidence 의 arrival 마다 belief 의 incremental refinement". Bayes (1763) 의 sermon 에서 출발 의, 2026 modern stack 의 PyMC 5, NumPyro 0.15, Stan 2.34 의 통한 millions-of-parameters posterior 의 NUTS / HMC sampling 의 routine.
매 핵심
매 공식
- Bayes' rule:
P(H|E) = P(E|H) × P(H) / P(E) - Sequential update:
posterior_t = likelihood_t × posterior_{t-1} - Log-form (numerical stability):
log P(H|E) = log P(E|H) + log P(H) - log P(E)
매 conjugate priors
- Beta–Binomial (CTR, conversion rate)
- Gamma–Poisson (event counts, arrival rate)
- Normal–Normal (sensor fusion, A/B continuous metric)
- Dirichlet–Multinomial (categorical preferences)
매 응용
- A/B testing — early-stopping, peeking 의 robust handling.
- Spam filter — Naive Bayes 의 incremental email update.
- Robot localization — particle filter 의 prior 와 sensor likelihood 의 fuse.
- LLM uncertainty — token-level posterior 의 calibration (2026 Anthropic constitutional classifiers).
💻 패턴
Beta–Binomial conjugate (CTR)
from scipy import stats
import numpy as np
# Prior: Beta(1, 1) = uniform
alpha, beta = 1.0, 1.0
# Observe: 73 clicks out of 1000 impressions
clicks, impressions = 73, 1000
alpha_post = alpha + clicks
beta_post = beta + (impressions - clicks)
posterior = stats.beta(alpha_post, beta_post)
print(f"Posterior mean CTR: {posterior.mean():.4f}")
print(f"95% credible interval: {posterior.interval(0.95)}")
Sequential update (online)
def online_beta_update(alpha, beta, click: bool):
return (alpha + click, beta + (1 - click))
a, b = 1.0, 1.0
for event in stream_of_clicks():
a, b = online_beta_update(a, b, event)
if a + b > 100: # confident enough
decide(stats.beta(a, b).mean())
PyMC 5 hierarchical
import pymc as pm
import numpy as np
variants = ["A", "B", "C"]
clicks = np.array([73, 91, 82])
impressions = np.array([1000, 1010, 990])
with pm.Model() as model:
mu = pm.Beta("mu", 1, 1)
kappa = pm.HalfNormal("kappa", 10)
theta = pm.Beta("theta", mu * kappa, (1 - mu) * kappa, shape=len(variants))
pm.Binomial("y", n=impressions, p=theta, observed=clicks)
idata = pm.sample(2000, tune=1000, target_accept=0.95)
pm.summary(idata, var_names=["theta"])
NumPyro NUTS (GPU-accelerated, JAX)
import numpyro
import numpyro.distributions as dist
from numpyro.infer import MCMC, NUTS
import jax.numpy as jnp
def model(impressions, clicks=None):
p = numpyro.sample("p", dist.Beta(1, 1))
numpyro.sample("obs", dist.Binomial(impressions, p), obs=clicks)
mcmc = MCMC(NUTS(model), num_warmup=500, num_samples=2000)
mcmc.run(jax.random.PRNGKey(0), impressions=jnp.array(1000), clicks=jnp.array(73))
mcmc.print_summary()
Bayesian online change-point detection
def bocpd_step(observation, run_length_probs, hazard=1/250):
"""Adams & MacKay 2007."""
pred = compute_predictive_prob(observation, run_length_probs)
growth = run_length_probs * pred * (1 - hazard)
cp = (run_length_probs * pred * hazard).sum()
new = np.concatenate([[cp], growth])
return new / new.sum()
매 결정 기준
| 상황 | Approach |
|---|---|
| 작은 N + conjugate prior 의 fit | closed-form (Beta–Binomial) |
| Hierarchical + ~10k params | PyMC NUTS (CPU) |
| Large model + GPU 의 가능 | NumPyro (JAX) |
| Streaming / sub-ms latency | Online conjugate update |
| Discrete latent 의 dominant | particle filter / variational |
기본값: A/B test 의 default — Beta–Binomial conjugate + 95% credible interval.
🔗 Graph
- 부모: Bayes-Theorem
- 변형: Belief-Revision · Inference-Coupled Persistence
- 응용: Item-Item-Collaborative-Filtering · Statistical-Analysis
- Adjacent: 몬테카를로 시뮬레이션 · Multi-agent-System
🤖 LLM 활용
언제: A/B early-stopping decision, sensor fusion, parameter uncertainty 의 explicit propagation. 언제 X: data 의 abundant + flat likelihood 의 dominant 인 경우 — frequentist MLE 의 sufficient.
❌ 안티패턴
- Improper prior 의 use: posterior 의 not normalize 의 가능 — proper prior 의 verify.
- Prior 의 sneaking strong assumption: subjective prior 의 sensitivity analysis 의 필수.
- Peeking 의 misinterpretation: Bayesian posterior 의 frequentist p-value 의 X — separate calibration.
- MCMC convergence 의 무시: R-hat > 1.01, ESS < 400 의 즉시 의 reject.
🧪 검증 / 중복
- Verified (Gelman et al. Bayesian Data Analysis 3rd, McElreath Statistical Rethinking 2nd).
- 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — full Bayesian updating with PyMC 5, NumPyro, online BOCPD |