การประเมินผลด้วย ROUGE
ROUGE เป็นเมตริกที่นิยมใช้ในการประเมินงานสรุปข้อความ โดยตรวจสอบความคล้ายคลึงระหว่างผลการทำนายและข้อความอ้างอิง ในแบบฝึกหัดนี้ได้เตรียมสรุปที่โมเดลสร้างขึ้น (predictions) และสรุปอ้างอิง (references) ไว้ให้แล้ว ให้คำนวณคะแนนเพื่อดูว่าโมเดลทำงานได้ดีเพียงใด
ไลบรารี evaluate โหลดไว้ให้เรียบร้อยแล้ว
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Python เบื้องต้นสำหรับ LLMs
คำแนะนำการฝึกหัด
- โหลดเมตริก 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)