การประเมินด้วย EM
Exact Match ช่วยประเมินโมเดลในงาน extractive question answering โดยตรวจสอบว่าคำตอบตรงกันทุกตัวอักษรหรือไม่ — ตามชื่อที่บอกไว้แล้ว! มี predictions และ references สำหรับการประเมินให้พร้อมแล้ว รวมถึงไลบรารี evaluate ที่โหลดไว้ให้แล้วเช่นกัน
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Python เบื้องต้นสำหรับ LLMs
คำแนะนำการฝึกหัด
- โหลดเมตริก 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: ", ____)