fix(ai_news): set weight=0 and add Spearman IC validation harness
검증 전 gradient 차단 + IC 측정 인프라. - schema.py: DEFAULT_WEIGHTS["ai_news"] 0.8 → 0.0 + 1회성 migration: 기존 운영 row 의 0.8 값 자동 reset (사용자가 명시 조정한 다른 값은 그대로 유지) - ai_news/validation.py: compute_ic() — 일자별 score_raw × forward return Spearman 상관, ic_mean/ic_std/ic_per_day 반환, verdict 분류 (skip/weak/strong) - router.py: GET /api/stock/screener/ai-news/ic?days=30&horizon=1 - 단위 테스트 5개: empty DB, strong +IC, random ≈0 IC, min_news_count 필터, horizon=5 배경: adversarial review 결과 — ai_news 가중치 0.8 이 검증 없이 출시됨. 4주+ 데이터 누적 후 IC > 0.05 확인 전까지 데이터 수집은 계속하되 가중합 영향만 차단. 운영 DB row 의 0.8 → 0.0 자동 reset 도 같은 의도. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,7 +12,9 @@ DEFAULT_WEIGHTS = {
|
||||
"rs_rating": 1.2,
|
||||
"ma_alignment": 1.0,
|
||||
"vcp_lite": 0.8,
|
||||
"ai_news": 0.8,
|
||||
# ai_news: 검증 전 gradient 차단 (4주 IC > 0.05 확인 후 활성화).
|
||||
# 데이터 수집은 계속, 가중합 영향만 0.
|
||||
"ai_news": 0.0,
|
||||
}
|
||||
DEFAULT_NODE_PARAMS = {
|
||||
"foreign_buy": {"window_days": 5},
|
||||
@@ -143,6 +145,11 @@ def ensure_screener_schema(conn: sqlite3.Connection) -> None:
|
||||
if "ai_news" not in w:
|
||||
w["ai_news"] = DEFAULT_WEIGHTS["ai_news"]
|
||||
changed = True
|
||||
# One-time reset: ai_news default 0.8 → 0.0 (검증 전 gradient 차단).
|
||||
# 사용자가 명시적으로 0.8 외 값을 설정했다면 영향 없음.
|
||||
elif w.get("ai_news") == 0.8:
|
||||
w["ai_news"] = 0.0
|
||||
changed = True
|
||||
if "ai_news" not in p:
|
||||
p["ai_news"] = DEFAULT_NODE_PARAMS["ai_news"]
|
||||
changed = True
|
||||
|
||||
Reference in New Issue
Block a user