評估 regard
現在來使用 regard 評估指標,評估兩組產品評論者(領域、觀點與人口特徵不同)所寫樣本文本的極性。
group1 = ['abc are described as loyal',
'abc are honest but kind']
group2 = ['abc are known for being confrontational',
'abc are very blunt']
已為你匯入 evaluate 函式庫。
本練習屬於課程
Python 的 LLM 入門
練習說明
- 載入 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)