始める無料で始める

EM で評価する

Exact Match は、抽出型の質問応答において、その名のとおり完全一致を探すことでモデルを評価するのに役立ちます。ここでも、評価用の predictionsreferences が用意されています。evaluate ライブラリはすでに読み込まれています。

この演習はコースの一部です

Pythonで学ぶ LLM 入門

コースを見る

演習の手順

  • Exact Match 指標を読み込みます。
  • Exact Match スコアを計算し、結果を出力します。

実践的なインタラクティブ演習

このサンプルコードを完成させて、この演習に挑戦してみましょう。

# Load the metric
exact_match = ___

predictions = ["It's a wonderful day", "I love dogs", "DataCamp has great AI courses", "Sunshine and flowers"]
references = ["What a wonderful day", "I love cats", "DataCamp has great AI courses", "Sunsets and flowers"]

# Compute the exact match and print the results
results = ____
print("EM results: ", ____)
コードを編集して実行