เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

การประเมินด้วย 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: ", ____)
แก้ไขและรันโค้ด