[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,63 +2,174 @@
|
||||
id: wiki-2026-0508-predictive-analytics
|
||||
title: Predictive Analytics
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [BIZ-PRED-ANA-001]
|
||||
aliases: [Predictive Modeling, Forecasting Analytics]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 1.0
|
||||
tags: [data-Analysis, predictive-analytics, forecasting, machine-learning, Statistics, business-intelligence]
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [ml, analytics, forecasting, regression, time-series]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-26
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: Python
|
||||
framework: scikit-learn / XGBoost / Prophet / PyTorch Forecasting
|
||||
---
|
||||
|
||||
# Predictive Analytics (예측 분석)
|
||||
# Predictive Analytics
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> "과거의 패턴을 집요하게 분석하여 미래의 불확실성을 확률적 확신으로 치환하고, 보이지 않는 기회와 위기를 선제적으로 포착하라" — 역사적 데이터와 통계 알고리즘, 머신러닝 기법을 활용하여 미래의 사건이나 결과를 예측하고 의사결정을 지원하는 분석 방법론.
|
||||
## 매 한 줄
|
||||
> **"매 historical data 로 future outcomes 예측 — regression, classification, time series 의 union"**. 1990s statistics 에서 출발해 2010s ML 으로 mainstream, 2026 currently transformer-based forecasting (TimesFM, Chronos) 이 tabular 와 sequence 에서 공존. Business intelligence, supply chain, churn, fraud 의 매 backbone.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
- **추출된 패턴:** "Temporal Patterns and Probabilistic Extrapolation" — 시계열 데이터나 다각도의 변수들 사이에서 반복되는 인과/상관 관계를 학습하여, 새로운 상황이 주어졌을 때 가장 발생 가능성이 높은 시나리오를 수치화하여 제시하는 패턴.
|
||||
- **주요 활용 사례:**
|
||||
- **Churn Prediction:** 고객의 이탈 징후를 미리 포착하여 방어 전략 수립.
|
||||
- **Demand Forecasting:** 재고 최적화 및 공급망 관리 효율화.
|
||||
- **Risk Scoring:** 신용 등급 산정 및 금융 사기 방지.
|
||||
- **[[Predictive_Maintenance|Predictive Maintenance]]:** 기계 고장 전 이상 신호를 탐지하여 유지보수 수행.
|
||||
- **의의:** 수동적인 사후 분석(Descriptive)에서 능동적인 사전 대응(Predictive)으로 비즈니스 패러다임을 전환시키며, 최적화된 행동 방향까지 제시하는 처방적 분석(Prescriptive)의 기반이 됨.
|
||||
## 매 핵심
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌:** 선형 회귀와 같은 단순 통계 모델에 의존하던 방식에서, 이제는 딥러닝과 실시간 스트리밍 분석을 결합하여 초단위의 변화까지 반영하는 고정밀 예측으로 고도화됨.
|
||||
- **정책 변화:** Antigravity 프로젝트는 1,174개 문서의 가드닝 완료 시점과 리소스 소모량을 실시간으로 예측 분석하여, 전체 프로젝트 로드맵의 오차를 최소화하는 스마트 스케줄링을 수행함.
|
||||
### 매 problem types
|
||||
- **Regression**: continuous target (revenue, demand, price).
|
||||
- **Classification**: discrete label (churn yes/no, fraud type).
|
||||
- **Time series**: temporally indexed (sales, sensor, stock).
|
||||
- **Survival**: time-to-event (customer lifetime, equipment failure).
|
||||
- **Ranking**: ordering items (recommendation, search).
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- [[Operations-Management|Operations-Management]], [[Time-Series-Analysis|Time-Series-Analysis]], [[Logistic-Regression|Logistic-Regression]], [[Outlier-Detection-Techniques|Outlier-Detection-Techniques]]
|
||||
- **Raw Source:** 10_Wiki/Topics/AI/Predictive-Analytics.md
|
||||
### 매 modern stack (2026)
|
||||
- **Tabular**: XGBoost / LightGBM / CatBoost — 매 still SOTA on most tabular.
|
||||
- **Deep tabular**: TabPFN v2, FT-Transformer — 매 zero-shot tabular foundation.
|
||||
- **Time series**: Chronos (Amazon), TimesFM (Google), Moirai — 매 pretrained TS foundation models.
|
||||
- **Classic TS**: Prophet, statsforecast (AutoARIMA, ETS) — 매 baseline.
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
### 매 workflow
|
||||
1. EDA + feature engineering.
|
||||
2. Train/val/test split (temporal for TS).
|
||||
3. Model selection + CV.
|
||||
4. Hyperparameter tuning (Optuna).
|
||||
5. Calibration + interpretability (SHAP).
|
||||
6. Deployment + monitoring (drift detection).
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
## 💻 패턴
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
### XGBoost regression baseline
|
||||
```python
|
||||
import xgboost as xgb
|
||||
from sklearn.model_selection import KFold
|
||||
from sklearn.metrics import mean_absolute_error
|
||||
import numpy as np
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
X, y = load_data()
|
||||
kf = KFold(n_splits=5, shuffle=True, random_state=42)
|
||||
scores = []
|
||||
for tr, va in kf.split(X):
|
||||
model = xgb.XGBRegressor(
|
||||
n_estimators=2000, learning_rate=0.03, max_depth=6,
|
||||
subsample=0.8, colsample_bytree=0.8,
|
||||
early_stopping_rounds=50, eval_metric="mae",
|
||||
)
|
||||
model.fit(X.iloc[tr], y.iloc[tr], eval_set=[(X.iloc[va], y.iloc[va])], verbose=False)
|
||||
scores.append(mean_absolute_error(y.iloc[va], model.predict(X.iloc[va])))
|
||||
print(f"CV MAE: {np.mean(scores):.4f} +/- {np.std(scores):.4f}")
|
||||
```
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
### LightGBM classification w/ early stopping
|
||||
```python
|
||||
import lightgbm as lgb
|
||||
model = lgb.LGBMClassifier(
|
||||
n_estimators=5000, learning_rate=0.02, num_leaves=63,
|
||||
min_child_samples=20, reg_alpha=0.1, reg_lambda=0.1,
|
||||
)
|
||||
model.fit(
|
||||
X_tr, y_tr,
|
||||
eval_set=[(X_va, y_va)],
|
||||
callbacks=[lgb.early_stopping(100), lgb.log_evaluation(0)],
|
||||
)
|
||||
proba = model.predict_proba(X_te)[:, 1]
|
||||
```
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
### Time series with TimesFM (foundation model, zero-shot)
|
||||
```python
|
||||
import timesfm
|
||||
tfm = timesfm.TimesFm(
|
||||
hparams=timesfm.TimesFmHparams(backend="gpu", per_core_batch_size=32),
|
||||
checkpoint=timesfm.TimesFmCheckpoint(huggingface_repo_id="google/timesfm-2.0-500m"),
|
||||
)
|
||||
forecast, _ = tfm.forecast(
|
||||
inputs=[history_series], # list of np.array
|
||||
freq=[0], # 0=high freq, 1=med, 2=low
|
||||
horizon_len=96,
|
||||
)
|
||||
```
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
### Prophet (interpretable seasonality)
|
||||
```python
|
||||
from prophet import Prophet
|
||||
m = Prophet(yearly_seasonality=True, weekly_seasonality=True, changepoint_prior_scale=0.05)
|
||||
m.add_country_holidays(country_name="US")
|
||||
m.fit(df) # df with ds, y columns
|
||||
future = m.make_future_dataframe(periods=90)
|
||||
fcst = m.predict(future) # yhat, yhat_lower, yhat_upper
|
||||
```
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
### SHAP explainability
|
||||
```python
|
||||
import shap
|
||||
explainer = shap.TreeExplainer(model)
|
||||
shap_values = explainer.shap_values(X_te)
|
||||
shap.summary_plot(shap_values, X_te)
|
||||
shap.waterfall_plot(shap.Explanation(values=shap_values[0], base_values=explainer.expected_value, data=X_te.iloc[0]))
|
||||
```
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
### Probability calibration
|
||||
```python
|
||||
from sklearn.calibration import CalibratedClassifierCV
|
||||
calibrated = CalibratedClassifierCV(base_model, method="isotonic", cv="prefit")
|
||||
calibrated.fit(X_va, y_va)
|
||||
# Brier score + reliability diagram on test
|
||||
```
|
||||
|
||||
### Drift monitoring (Evidently)
|
||||
```python
|
||||
from evidently.report import Report
|
||||
from evidently.metric_preset import DataDriftPreset
|
||||
report = Report(metrics=[DataDriftPreset()])
|
||||
report.run(reference_data=X_train, current_data=X_prod)
|
||||
report.save_html("drift.html")
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Tabular, <1M rows | XGBoost / LightGBM |
|
||||
| Tabular, mixed features | CatBoost |
|
||||
| Zero-shot tabular | TabPFN v2 |
|
||||
| Time series, single series | Prophet / AutoARIMA |
|
||||
| Time series, many series, zero-shot | Chronos / TimesFM |
|
||||
| Need interpretability | Linear / GAM + SHAP |
|
||||
| Very large (>10M) tabular | LightGBM w/ histogram |
|
||||
|
||||
**기본값**: LightGBM + Optuna + SHAP for tabular; Chronos zero-shot for new TS problems.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Machine-Learning]] · [[Statistics]]
|
||||
- 변형: [[Time-Series-Forecasting]] · [[Regression]] · [[Classification]]
|
||||
- 응용: [[Churn-Prediction]] · [[Demand-Forecasting]] · [[Fraud-Detection]]
|
||||
- Adjacent: [[XGBoost]] · [[LightGBM]] · [[SHAP]] · [[Prophet]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: business outcome forecasting, risk scoring, demand planning, anomaly detection 의 supervised learning.
|
||||
**언제 X**: causal inference (use [[Causal-Inference]]), prescriptive optimization (use [[Optimization]]).
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Data leakage**: 매 future info in training features — invalidates evaluation.
|
||||
- **Random split on time series**: must use temporal split.
|
||||
- **Ignoring calibration**: probabilities used for decisions but never calibrated.
|
||||
- **No drift monitoring**: model decays silently in production.
|
||||
- **Over-engineering deep nets for small tabular**: GBDT wins under 100k rows.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Kaggle Grandmaster patterns, Amazon Chronos paper 2024, Google TimesFM 2024).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — full predictive analytics workflow with 2026 foundation models |
|
||||
|
||||
Reference in New Issue
Block a user