始める無料で始める

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)
コードを編集して実行