File size: 615 Bytes
0c1f7b6 dcf770c 0c1f7b6 5c5c1ed 0c1f7b6 5c5c1ed 0c1f7b6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import pandas as pd
from datasets import load_dataset
data = load_dataset('relbert/semeval2012_relational_similarity_v3')
stats = []
for k in data.keys():
for i in data[k]:
stats.append(
{
'relation_type': i['relation_type'],
'split': k,
'positives': len(i['positives']),
'negatives': len(i['negatives']),
'level': i['level']
})
df = pd.DataFrame(stats)
g = df.groupby(['relation_type', 'level', 'split']).sum()
g.to_csv('stats.csv')
with open('stats.md', 'w') as f:
f.write(g.to_markdown())
|