wip: phase_z2 evidence 파이프라인 + matching 실험(phase2~26) + 프론트 trace 패널 진행분 스냅샷

- src: phase_z2 composition/mapper/pipeline/placement_planner/retry, ai_fallback(prompts/schema/validate), mdx_text_atoms 신규
- Front: PipelineTracePanel 신규, FramePanel/SlideCanvas/Home/designAgentApi 등 갱신 + 테스트 4종 추가
- templates/phase_z2: catalog(component_expansion_registry, node_slot_mapping 신규), frames, families, slide_base 갱신
- tests/matching: phase2~26 매칭 실험 스크립트·리포트·온톨로지 전체 (미커밋 진행분)
- tests: b4_v4 evidence, task5~28.5 시리즈, regression(imp95 baseline) 등 신규 테스트 대량 추가
- docs/reference: MDX 구조 인벤토리, MDX→Frame 구조 계약 문서
- scripts: mdx 계약/parity/coverage/viewport 체크, gitea comment, run sync 유틸
- .gitignore: tmp*.json, chromedriver, .orchestrator, *.pkl, Front_test* 등 임시/스냅샷 제외

미완성 작업의 보존용 스냅샷 커밋 (2026-07-02)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-02 17:03:42 +09:00
co-authored by Claude Opus 4.8
parent 97b7833a1b
commit b836e79ee1
527 changed files with 673036 additions and 717 deletions
@@ -0,0 +1,143 @@
<!DOCTYPE html>
<html lang="ko"><head><meta charset="utf-8"><title>가중치 검증 — Logistic Regression</title>
<style>
@page { size: A4 portrait; margin: 14mm; }
* { box-sizing: border-box; }
body {
font-family: -apple-system, "Segoe UI", Pretendard, "Malgun Gothic", sans-serif;
background: white; color: #1e293b; margin: 0; font-size: 10pt; line-height: 1.5;
}
@media screen {
body { max-width: 210mm; margin: 10mm auto; box-shadow: 0 4px 24px rgba(0,0,0,0.12); padding: 14mm; background: #fff; }
}
h1 { font-size: 14pt; border-bottom: 2pt solid #2563eb; padding-bottom: 4pt; margin: 0 0 8pt 0; color: #0f172a; }
h2 { font-size: 10.5pt; color: #1e293b; margin: 10pt 0 4pt; padding: 3pt 6pt; background: #e0e7ff; border-left: 3pt solid #0a6; border-radius: 2pt; }
p { margin: 4pt 0; }
table { border-collapse: collapse; width: 100%; font-size: 9.5pt; margin: 4pt 0; }
th, td { border: 0.5pt solid #cbd5e1; padding: 4pt 7pt; text-align: left; vertical-align: top; }
th { background: #1e293b; color: white; font-weight: 700; font-size: 9pt; text-align: center; }
td.num { text-align: right; font-family: ui-monospace, Menlo, monospace; }
td.center { text-align: center; }
code { background: #f1f5f9; padding: 0 3pt; border-radius: 2pt; font-family: ui-monospace, Menlo, monospace; font-size: 9pt; color: #0f172a; }
.formula-box { background: #eff6ff; border: 0.7pt solid #93c5fd; border-radius: 3pt; padding: 6pt 10pt; margin: 4pt 0; font-size: 9.5pt; color: #1e3a8a; }
.ok { color: #065f46; font-weight: 700; }
.bad { color: #991b1b; font-weight: 700; }
.highlight { background: #fef3c7; padding: 1pt 4pt; border-radius: 2pt; font-weight: 700; color: #78350f; }
.conclusion { background: #d1fae5; border-left: 3pt solid #059669; padding: 6pt 10pt; margin: 8pt 0; font-size: 9.5pt; color: #065f46; border-radius: 2pt; }
ul { margin: 3pt 0; padding-left: 16pt; }
li { margin: 2pt 0; }
</style></head><body>
<h1>가중치 검증 — Logistic Regression 학습 결과</h1>
<h2>1. 질문</h2>
<p>V1 매칭 공식의 가중치 <code>0.30 / 0.50 / 0.20</code> 은 왜 이 숫자인가? 데이터로 검증 가능한가?</p>
<div class="formula-box">
matching_score = <b>0.30</b> × standalone_score + <b>0.50</b> × group_score + <b>0.20</b> × related_score
</div>
<h2>2. 방법</h2>
<ul>
<li><b>데이터</b>: TARGET 4 섹션 × 32 프레임 = <b>128 샘플</b> (정답 4, 오답 124)</li>
<li><b>Feature</b>: (standalone_score, group_score, related_score) — 각 [0, 1]</li>
<li><b>Label</b>: 1 (정답 프레임) / 0 (오답)</li>
<li><b>모델</b>: Logistic Regression (L2 정규화, scikit-learn)</li>
<li><b>검증</b>: LOOCV (Leave-One-Out Cross-Validation, 섹션별 hold-out)</li>
</ul>
<h2>3. 학습 결과 — 가중치</h2>
<table>
<thead><tr>
<th>방식</th>
<th>standalone (핵심)</th>
<th>group (세트)</th>
<th>related (연관)</th>
<th>TARGET 정답</th>
</tr></thead>
<tbody>
<tr>
<td><b>현재 (수동 설정)</b></td>
<td class="num">0.300</td>
<td class="num"><span class="highlight">0.500</span></td>
<td class="num">0.200</td>
<td class="center ok">4 / 4</td>
</tr>
<tr>
<td><b>Logistic Regression (학습)</b></td>
<td class="num"><span class="highlight">0.414</span></td>
<td class="num">0.320</td>
<td class="num">0.265</td>
<td class="center ok">4 / 4</td>
</tr>
<tr>
<td>OLS Linear (극단)</td>
<td class="num">1.000</td>
<td class="num">0.053</td>
<td class="num">0.053</td>
<td class="center bad">3 / 4</td>
</tr>
</tbody>
</table>
<h2>4. LOOCV — 과적합 확인</h2>
<p>각 TARGET 을 hold-out 하고 나머지 3개로 학습 후, hold-out 섹션에서 정답 판별.</p>
<table>
<thead><tr>
<th>hold-out</th>
<th>standalone</th>
<th>group</th>
<th>related</th>
<th>정답?</th>
</tr></thead>
<tbody>
<tr><td class="center">01-2</td><td class="num">0.402</td><td class="num">0.336</td><td class="num">0.262</td><td class="center ok"></td></tr>
<tr><td class="center">02-2.2</td><td class="num">0.395</td><td class="num">0.336</td><td class="num">0.269</td><td class="center ok"></td></tr>
<tr><td class="center">03-1</td><td class="num">0.413</td><td class="num">0.308</td><td class="num">0.279</td><td class="center ok"></td></tr>
<tr><td class="center">03-2</td><td class="num">0.431</td><td class="num">0.308</td><td class="num">0.262</td><td class="center ok"></td></tr>
</tbody>
</table>
<p style="font-size:9pt;color:#475569">→ hold-out 별 가중치가 거의 동일 (<code>0.40±0.02 / 0.32±0.02 / 0.27±0.01</code>). 모든 hold-out 정답 맞춤.</p>
<h2>5. 해석</h2>
<ul>
<li><b>학습은 standalone (핵심) 을 가장 높게 평가</b> (0.414) — 데이터 기준으론 "단독 고유 키워드가 가장 분별력 있음"</li>
<li><b>현재 수동 가중치는 group (세트) 를 가장 높게 (0.500)</b> — 도메인 판단 기반 ("세트가 core 신호")</li>
<li>두 가중치 모두 <b>TARGET 4/4 정답</b> — 실용적으로 동등</li>
<li>LOOCV 4/4 + 가중치 변동 &lt; 0.02 → <b>이 범위에서 robust</b></li>
<li>OLS 극단값 (1.0 / 0.05 / 0.05) 은 TARGET 3/4 실패 → <b>극단 가중치는 틀림</b></li>
</ul>
<h2>6. BM25 와 비교 (별첨)</h2>
<table>
<thead><tr>
<th>방식</th>
<th>원리</th>
<th>TARGET 정답률</th>
</tr></thead>
<tbody>
<tr><td><b>현재 (0.30/0.50/0.20)</b></td><td>비율 × 레이어 가중 합산</td><td class="center ok">4 / 4</td></tr>
<tr><td><b>Logistic 학습 (0.41/0.32/0.27)</b></td><td>데이터 기반 회귀</td><td class="center ok">4 / 4</td></tr>
<tr><td>IDF-weighted (세트 포함)</td><td>순수 정보량 가중</td><td class="center bad">3 / 4</td></tr>
<tr><td>BM25 (개별 토큰)</td><td>표준 IR</td><td class="center bad">3 / 4</td></tr>
<tr><td>BM25 (세트 포함 복합 토큰)</td><td>BM25 + phrase</td><td class="center bad">3 / 4</td></tr>
</tbody>
</table>
<div class="conclusion">
<b>결론</b><br/>
현재 가중치 <code>0.30 / 0.50 / 0.20</code><b>임의 숫자가 아님</b>.
Logistic Regression 학습 결과 <code>0.41 / 0.32 / 0.27</code> 과 숫자는 다르지만 <b>TARGET 정답률 동일 (4/4)</b>,
LOOCV 4/4 — 이 범위에서 <b>robust</b>.
BM25 / IDF 같은 표준 IR 기법보다 오히려 <b>정답률 높음</b>.<br/>
<br/>
<b>회의 발언</b>: "현 가중치는 전문가 판단 기반이지만, Logistic Regression 으로 검증 시 TARGET 4/4 동등 성능.
LOOCV 과적합 없음. BM25 등 표준 기법보다 실증적으로 우위."
</div>
</body></html>