使用 EM 評估
Exact Match(EM)用於評估抽取式問答模型,重點在於檢查是否「完全相同」。你已經獲得一組要評估的 predictions 與 references。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: ", ____)