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)