init
Browse files- get_stats.py +27 -0
- stats.csv +27 -0
get_stats.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
from datasets import load_dataset
|
3 |
+
|
4 |
+
data = load_dataset('relbert/conceptnet_high_confidence')
|
5 |
+
stats = []
|
6 |
+
for k in data.keys():
|
7 |
+
for i in data[k]:
|
8 |
+
stats.append({'relation_type': i['relation_type'], 'split': k, 'positives': len(i['positives']), 'negatives': len(i['negatives'])})
|
9 |
+
df = pd.DataFrame(stats)
|
10 |
+
df_train = df[df['split'] == 'train']
|
11 |
+
df_valid = df[df['split'] == 'validation']
|
12 |
+
stats = []
|
13 |
+
for r in df['relation_type'].unique():
|
14 |
+
_df_t = df_train[df_train['relation_type'] == r]
|
15 |
+
_df_v = df_valid[df_valid['relation_type'] == r]
|
16 |
+
stats.append({
|
17 |
+
'relation_type': r,
|
18 |
+
'positive (train)': 0 if len(_df_t) == 0 else _df_t['positives'].values[0],
|
19 |
+
'negative (train)': 0 if len(_df_t) == 0 else _df_t['negatives'].values[0],
|
20 |
+
'positive (validation)': 0 if len(_df_v) == 0 else _df_v['positives'].values[0],
|
21 |
+
'negative (validation)': 0 if len(_df_v) == 0 else _df_v['negatives'].values[0],
|
22 |
+
})
|
23 |
+
|
24 |
+
df = pd.DataFrame(stats).sort_values(by=['relation_type'])
|
25 |
+
df.to_csv('stats.csv', index=None)
|
26 |
+
|
27 |
+
|
stats.csv
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
relation_type,positive (train),negative (train),positive (validation),negative (validation)
|
2 |
+
AtLocation,383,356,97,80
|
3 |
+
CapableOf,195,190,73,78
|
4 |
+
Causes,71,73,26,26
|
5 |
+
CausesDesire,9,7,11,11
|
6 |
+
CreatedBy,2,3,1,1
|
7 |
+
DefinedAs,1,1,2,2
|
8 |
+
Desires,16,15,12,12
|
9 |
+
HasA,67,86,17,17
|
10 |
+
HasFirstSubevent,2,3,1,1
|
11 |
+
HasLastSubevent,2,3,3,1
|
12 |
+
HasPrerequisite,168,176,57,54
|
13 |
+
HasProperty,94,100,39,49
|
14 |
+
HasSubevent,125,128,40,54
|
15 |
+
IsA,310,279,98,106
|
16 |
+
MadeOf,17,15,7,5
|
17 |
+
MotivatedByGoal,14,15,11,11
|
18 |
+
NotCapableOf,15,13,1,1
|
19 |
+
NotDesires,4,4,4,1
|
20 |
+
NotHasProperty,1,3,1,1
|
21 |
+
NotIsA,1,0,1,1
|
22 |
+
NotMadeOf,1,3,0,0
|
23 |
+
PartOf,34,40,7,5
|
24 |
+
ReceivesAction,18,16,8,6
|
25 |
+
RelatedTo,1,2,0,0
|
26 |
+
SymbolOf,0,0,2,3
|
27 |
+
UsedFor,249,269,81,74
|