ROUGE로 평가하기
ROUGE는 예측과 기준 답안 간의 유사도를 확인하므로 요약 과제를 평가할 때 흔히 사용돼요. 모델이 생성한 요약 predictions와 검증용 기준 요약 references가 제공되어 있어요. 점수를 계산해 모델의 성능을 확인해 보세요.
evaluate 라이브러리는 미리 불러와 두었어요.
이 연습은 강의의 일부입니다
Python으로 배우는 LLM 입문
연습 안내
- ROUGE 메트릭을 로드하세요.
- 예측 요약과 기준 요약 사이의 ROUGE 점수를 계산하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Load the rouge metric
rouge = ____
predictions = ["""Pluto is a dwarf planet in our solar system, located in the Kuiper Belt beyond Neptune, and was formerly considered the ninth planet until its reclassification in 2006."""]
references = ["""Pluto is a dwarf planet in the solar system, located in the Kuiper Belt beyond Neptune, and was previously deemed as a planet until it was reclassified in 2006."""]
# Calculate the rouge scores between the predicted and reference summaries
results = ____
print("ROUGE results: ", results)