การประเมิน regard
ถึงเวลาใช้เมตริก regard เพื่อวิเคราะห์ขั้วความคิดเห็น (polarity) ในรายการข้อความตัวอย่างสองชุด ซึ่งเชื่อมโยงกับกลุ่มผู้รีวิวสินค้าที่มีโดเมน มุมมอง และลักษณะประชากรที่แตกต่างกัน
group1 = ['abc are described as loyal',
'abc are honest but kind']
group2 = ['abc are known for being confrontational',
'abc are very blunt']
ไลบรารี evaluate ถูกนำเข้ามาให้แล้ว
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Python เบื้องต้นสำหรับ LLMs
คำแนะนำการฝึกหัด
- โหลดเมตริก regard และ regard-comparison
- คำนวณค่า regard (คะแนนขั้วความคิดเห็น) สำหรับแต่ละกลุ่มแยกกัน
- คำนวณค่า regard เปรียบเทียบระหว่างสองกลุ่มเพื่อเปรียบเทียบขั้วความคิดเห็น
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Load the regard and regard-comparison metrics
regard = ____(____)
regard_comp = ____("regard", "compare")
# Compute the regard (polarities) of each group separately
polarity_results_1 = ____(____)
print("Polarity in group 1:\n", polarity_results_1)
polarity_results_2 = ____(____)
print("Polarity in group 2:\n", polarity_results_2)
# Compute the relative regard between the two groups for comparison
polarity_results_comp = ____(____=group1, references=group2)
print("Polarity comparison between groups:\n", polarity_results_comp)