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,174 @@
|
||||
---
|
||||
id: wiki-2026-0508-predictive-analytics
|
||||
title: Predictive Analytics
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [Predictive Modeling, Forecasting Analytics]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [ml, analytics, forecasting, regression, time-series]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: Python
|
||||
framework: scikit-learn / XGBoost / Prophet / PyTorch Forecasting
|
||||
---
|
||||
|
||||
# Predictive Analytics
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 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.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 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).
|
||||
|
||||
### 매 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.
|
||||
|
||||
### 매 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).
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### 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
|
||||
|
||||
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}")
|
||||
```
|
||||
|
||||
### 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]
|
||||
```
|
||||
|
||||
### 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,
|
||||
)
|
||||
```
|
||||
|
||||
### 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
|
||||
```
|
||||
|
||||
### 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]))
|
||||
```
|
||||
|
||||
### 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-Analysis|Time-Series-Forecasting]] · [[Regression]]
|
||||
- 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