Datasets:

Languages:
English
Size:
< 1K
ArXiv:
Libraries:
Datasets
License:
File size: 1,720 Bytes
1bb8d13
4a89ca9
1bb8d13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4a89ca9
1bb8d13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4a89ca9
1bb8d13
4a89ca9
 
1bb8d13
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import json
from itertools import permutations
from string import ascii_letters
from statistics import mean
import numpy as np
import pandas as pd

with open("data/data_processed.new.test.jsonl") as f:
    data = [json.loads(line) for line in f]
with open("data/data_processed.new.validation.jsonl") as f:
    data += [json.loads(line) for line in f]

tmp = {}
for i in data:
    if i['relation_type'] not in tmp:
        tmp[i['relation_type']] = i['scores_all']
    else:
        tmp[i['relation_type']] = i['scores_all'] + tmp[i['relation_type']]
num_annotators = len(list(tmp.values())[0][0])
df = None
for r, scores in tmp.items():
    corr_matrix = np.ones((num_annotators, num_annotators)) * 100
    for a, b in permutations(range(num_annotators), 2):
        score_a = [s[a] for s in scores]
        score_b = [s[b] for s in scores]
        corr_matrix[a][b] = pd.DataFrame([score_a, score_b]).T.corr("spearman").values[0][1] * 100
    corr_df = pd.DataFrame(corr_matrix, columns=[ascii_letters[i].upper() for i in range(num_annotators)],
                           index=[ascii_letters[i].upper() for i in range(num_annotators)])

    corr_df['Others'] = [pd.DataFrame([
        [s[a] for s in scores],
        [mean(_s for _n, _s in enumerate(s) if _n != a) for s in scores]
    ]).T.corr("spearman").values[0][1] * 100 for a in range(num_annotators)]
    corr_df = corr_df.T
    corr_df['Avg'] = corr_df.mean(1)
    corr_df = corr_df.T
    print(r)
    print(corr_df.round(0).astype(int).to_latex())
    print()
    if df is None:
        df = corr_df
    else:
        df += corr_df

df = df/5
df = df.T
df.pop("Avg")
df['Avg'] = df.mean(1)
df = df.T
print("ALL")
print(df.round(0).astype(int).to_latex())