feat: prepare summary (No.7) section in certificate format
요약 항목도 같은 서식으로 준비한다. 정답셋이 없어 수치는 채울 수 없으므로
서식과 시현 절차만 확정하고, 결과 자리는 자리표시자로 둔다.
eval_rouge.py: 성적서 '4. 결과' 형식 JSON 출력(--out 으로 저장). 보고 대상이
ROUGE-1 recall 임을 reported_metric 으로 명시한다. 계획서 수식 분모가 참조
n-gram 수인데 전 차수 코드는 f1 을 반환해 정의가 어긋나 있었다.
show_summary_samples.py: 전 차수 '1. 데이터 준비' 의 {index, original} 형식
출력. 정답셋이 없으면 그 사실과 참조 문서를 알리고 종료한다.
시험방법 수정 두 곳 — 1,000건에서 300건으로(사람 작성 정답이 필요해 1,000건은
구축 비용 과다), 지표를 ROUGE-1 recall 로 명시.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
99f0ac9b88
commit
6308c6b452
3 files changed
+324
-5
No files matched your search
+55
-1
@@ -115,11 +115,53 @@ def _run_iaa(rows: list[dict], mode: str) -> None:
|
||||
print("여유가 충분합니다. 이 규격으로 본 구축을 진행해도 됩니다.")
|
||||
|
||||
|
||||
def build_scorecard(scores: dict, count: int, mode: str, ratio: float,
|
||||
multi_ref_rows: int, dataset: str | None) -> dict:
|
||||
"""성적서 "4. 결과" 게재 형식으로 정리한다.
|
||||
|
||||
보고 대상은 **ROUGE-1 recall** 이다. 계획서 p.24 수식의 분모가 참조 n-gram
|
||||
수이므로 recall 이 지표에 해당한다. f1 은 참고로만 남긴다. 전 차수 코드가
|
||||
f1 을 반환한 탓에 정의가 어긋나 있어, 어느 값을 보고하는지 명시한다.
|
||||
"""
|
||||
r1 = scores["rouge1"]
|
||||
target = 0.65
|
||||
return {
|
||||
"summary_performance": {
|
||||
"model": "O2O Summarizer",
|
||||
"test_dataset": {
|
||||
"total_samples": count,
|
||||
"multi_reference_samples": multi_ref_rows,
|
||||
"source": dataset or "(내장 dry-run 샘플)",
|
||||
},
|
||||
"rouge_scores": {
|
||||
"rouge1": scores["rouge1"],
|
||||
"rouge2": scores["rouge2"],
|
||||
"rougeL": scores["rougeL"],
|
||||
},
|
||||
"reported_metric": "rouge1_recall",
|
||||
"performance_metrics": {
|
||||
"n_gram_rouge_score": r1["recall"],
|
||||
"target": target,
|
||||
"achieved": r1["recall"] >= target,
|
||||
},
|
||||
"settings": {"tokenization": mode, "summary_ratio": ratio},
|
||||
"interpretation": {
|
||||
"n_gram_rouge_score":
|
||||
"참조 요약의 1-gram 중 %.1f%% 를 시스템 요약이 담아냄"
|
||||
% (r1["recall"] * 100),
|
||||
"note": "계획서 수식 분모가 참조 n-gram 수이므로 recall 을 보고한다. "
|
||||
"ROUGE-1 F1 %.4f 는 계획서 지표가 아니다." % r1["f1"],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def main() -> None:
|
||||
ap = argparse.ArgumentParser(description="요약 ROUGE 평가 (성능지표 No.7)")
|
||||
ap.add_argument("dataset", nargs="?", default=None, help="JSONL 정답셋 (없으면 dry-run)")
|
||||
ap.add_argument("--mode", choices=["lemma", "char"], default="lemma", help="토큰화 방식")
|
||||
ap.add_argument("--ratio", type=float, default=0.3, help="자체 요약 길이 비율")
|
||||
ap.add_argument("--out", help="scorecard JSON 저장 경로")
|
||||
ap.add_argument("--iaa", action="store_true",
|
||||
help="사람 상한 측정 — 참조 2개 이상인 행에서 작성자끼리 채점")
|
||||
args = ap.parse_args()
|
||||
@@ -169,8 +211,20 @@ def main() -> None:
|
||||
print(f" (참고: ROUGE-1 F1 = {scores['rouge1']['f1']:.4f} — 계획서 지표 아님)")
|
||||
if multi_ref_rows:
|
||||
print(f" 다중 참조 사용: {multi_ref_rows}/{len(pairs)}건")
|
||||
scorecard = build_scorecard(scores, len(pairs), args.mode, args.ratio,
|
||||
multi_ref_rows, args.dataset)
|
||||
rendered = json.dumps(scorecard, ensure_ascii=False, indent=2)
|
||||
print("\n" + "=" * 62)
|
||||
print("4. 결과")
|
||||
print()
|
||||
print(rendered)
|
||||
print("\n최종 결과 : 평균 수치 %.2f%%" % (r1 * 100))
|
||||
if args.out:
|
||||
Path(args.out).write_text(rendered + "\n", encoding="utf-8")
|
||||
print("\n%s 에 결과 기록" % args.out)
|
||||
|
||||
if is_dry:
|
||||
print("\n※ 이는 파이프라인 검증용 dry-run 수치입니다. 컴북스 요약 정답셋 수령 후 본 평가로 정식 측정.")
|
||||
print("\n※ 이는 파이프라인 검증용 dry-run 수치입니다. 요약 정답셋 수령 후 본 평가로 정식 측정.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user