sklearn.metrics.cohen_kappa_score?
sklearn.metrics.cohen_kappa_score(y1, y2, *, labels=None, weights=None, sample_weight=None)
Cohen的kappa:一種用于測量注釋器之間協議的統計數據。
此函數計算Cohen的kappa [1],該得分表示兩個注釋器在分類問題上的一致程度。 定義為
其中是分配給任何樣本的標簽上達成一致的經驗概率(觀察到的一致比率),是當兩個注釋器隨機分配標簽時的預期一致。是標簽上使用每個注釋器的經驗先驗估計[2]。
在用戶指南中閱讀更多內容。
參數 | 說明 |
---|---|
y1 | array, shape = [n_samples] 第一個注釋器分配的標簽。 |
y2 | array, shape = [n_samples] 由第二個注釋器分配的標簽。 Kappa統計信息是對稱的,因此將y1和y2交換不會改變該值。 |
labels | array, shape = [n_classes], optional 索引矩陣的標簽列表。這可以用于選擇標簽的子集。如果為None,則使用在y1或y2中至少出現一次的所有標簽。 |
weights | str, optional 加權類型以計算分數。None表示沒有加權;“linear”是指線性加權;“quadratic”是指二次加權。 |
sample_weight | array-like of shape (n_samples,), default=None 樣本權重。 |
返回值 | 說明 |
---|---|
kappa | float kappa統計信息,它是-1和1之間的數字。最大值表示完全一致。零或更低表示機會一致。 |
參考
1 J. Cohen (1960). “A coefficient of agreement for nominal scales”. Educational and Psychological Measurement 20(1):37-46. doi:10.1177/001316446002000104.
2 R. Artstein and M. Poesio (2008). “Inter-coder agreement for computational linguistics”. Computational Linguistics 34(4):555-596.