File size: 615 Bytes
c4a7c25 1d1b487 c4a7c25 1d1b487 c4a7c25 1d1b487 c4a7c25 |
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_v4')
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())
|