使用 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)