asahi417 commited on
Commit
dce486f
1 Parent(s): 84a7df8
.gitattributes CHANGED
@@ -61,3 +61,5 @@ data/t_rex.filter.validation.jsonl filter=lfs diff=lfs merge=lfs -text
61
  data/t_rex.filter.test.jsonl filter=lfs diff=lfs merge=lfs -text
62
  data/t_rex.filter.train.jsonl filter=lfs diff=lfs merge=lfs -text
63
  data/t_rex.filter.jsonl filter=lfs diff=lfs merge=lfs -text
 
 
 
61
  data/t_rex.filter.test.jsonl filter=lfs diff=lfs merge=lfs -text
62
  data/t_rex.filter.train.jsonl filter=lfs diff=lfs merge=lfs -text
63
  data/t_rex.filter.jsonl filter=lfs diff=lfs merge=lfs -text
64
+ data/stats.data_size.csv filter=lfs diff=lfs merge=lfs -text
65
+ data/t_rex.filter.sample.csv filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -37,20 +37,20 @@ we choose top-`max predicate` triples based on the frequency of the subject and
37
 
38
  - number of triples in each configuration
39
 
40
- | min entity / max predicate | 10 | 25 | 50 | 100 |
41
- |-----------------------------:|-----:|------:|------:|------:|
42
- | 1 | 5832 | 12075 | 20382 | 32986 |
43
- | 2 | 5309 | 10973 | 18415 | 29438 |
44
- | 3 | 4836 | 9943 | 16449 | 26001 |
45
- | 4 | 4501 | 9245 | 15196 | 23936 |
46
-
47
-
48
- | min entity | predicate |
49
- |-----------------------------:|------------:|
50
- | 1 | 659 |
51
- | 2 | 603 |
52
- | 3 | 557 |
53
- | 4 | 516 |
54
 
55
  - distribution of entities
56
 
 
37
 
38
  - number of triples in each configuration
39
 
40
+ | min entity / max predicate | 10 | 25 | 50 | 100 |
41
+ |-----------------------------:|-----:|-----:|------:|------:|
42
+ | 4 | 4501 | 9245 | 15196 | 23936 |
43
+ | 8 | 3557 | 7291 | 11804 | 18699 |
44
+ | 12 | 3132 | 6346 | 10155 | 16115 |
45
+ | 16 | 2769 | 5559 | 9014 | 14499 |
46
+
47
+
48
+ | min entity | predicate |
49
+ |-------------:|-----:|
50
+ | 4 | 516 |
51
+ | 8 | 409 |
52
+ | 12 | 366 |
53
+ | 16 | 321 |
54
 
55
  - distribution of entities
56
 
check_predicate.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import numpy as np
3
+ import pandas as pd
4
+
5
+ with open("data/t_rex.filter.jsonl") as f:
6
+ data = pd.DataFrame([json.loads(i) for i in f.read().split('\n') if len(i) > 0])
7
+ tmp = data.groupby("predicate").sample(10, replace=True)
8
+ tmp = tmp.drop_duplicates()
9
+ tmp.to_csv("data/t_rex.filter.sample.csv", index=False)
10
+
create_split.py CHANGED
@@ -1,10 +0,0 @@
1
- import json
2
- import numpy as np
3
-
4
- with open("data/t_rex.filter.jsonl") as f:
5
- data = [json.loads(i) for i in f.read().split('\n') if len(i) > 0]
6
-
7
- p, c = np.unique([i['predicate'] for i in data], return_counts=True)
8
- d = dict(zip(p.tolist(), c.tolist()))
9
- with open("data/t_rex.filter.predicate.json", 'w') as f:
10
- json.dump(d, f)
 
 
 
 
 
 
 
 
 
 
 
data/stats.data_size.csv CHANGED
@@ -1,5 +1,3 @@
1
- min entity / max predicate,10,25,50,100,predicate
2
- 1,5832,12075,20382,32986,659
3
- 2,5309,10973,18415,29438,603
4
- 3,4836,9943,16449,26001,557
5
- 4,4501,9245,15196,23936,516
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e9957f1edf8f50f209ee22c5b2c99aedf8f432dfc6d92beb13541ac6d8d81c06
3
+ size 164
 
 
data/t_rex.filter.sample.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e6733c3707cdbd270a070fd94f5717495c0f6d4e452dc6d4d4986fab741b35f7
3
+ size 6123997
filtering_purify.py CHANGED
@@ -14,6 +14,8 @@ from datasets import Dataset
14
 
15
  parameters_min_e_freq = [4, 8, 12, 16]
16
  parameters_max_p_freq = [100, 50, 25, 10]
 
 
17
  sns.set_theme(style="whitegrid")
18
 
19
  # load filtered data
@@ -119,9 +121,9 @@ if __name__ == '__main__':
119
  df_p.columns = [f"min entity: {mef}, max predicate: {mpf}" for mef, mpf in candidates]
120
  fig, axes = plt.subplots(2, 2, constrained_layout=True)
121
  fig.suptitle('Predicate Distribution over Different Configurations')
122
- for (x, y), mpf in zip([(0, 0), (0, 1), (1, 0), (1, 1)], [100, 50, 25, 10]):
123
- _df = df_p[[f"min entity: {mef}, max predicate: {mpf}" for mef in [1, 2, 3, 4]]]
124
- _df.columns = [f"min entity: {mef}" for mef in [1, 2, 3, 4]]
125
  ax = sns.lineplot(ax=axes[x, y], data=_df, linewidth=1)
126
  if mpf != 100:
127
  ax.legend_.remove()
@@ -136,9 +138,9 @@ if __name__ == '__main__':
136
  df_e.columns = [f"min entity: {mef}, max predicate: {mpf}" for mef, mpf in candidates]
137
  fig, axes = plt.subplots(2, 2, constrained_layout=True)
138
  fig.suptitle('Entity Distribution over Different Configurations')
139
- for (x, y), mpf in zip([(0, 0), (0, 1), (1, 0), (1, 1)], [100, 50, 25, 10]):
140
- _df = df_e[[f"min entity: {mef}, max predicate: {mpf}" for mef in [1, 2, 3, 4]]]
141
- _df.columns = [f"min entity: {mef}" for mef in [1, 2, 3, 4]]
142
  ax = sns.lineplot(ax=axes[x, y], data=_df, linewidth=1)
143
  ax.set(xscale='log')
144
  if mpf != 100:
 
14
 
15
  parameters_min_e_freq = [4, 8, 12, 16]
16
  parameters_max_p_freq = [100, 50, 25, 10]
17
+ assert len(parameters_min_e_freq) == 4
18
+ assert len(parameters_max_p_freq) == 4
19
  sns.set_theme(style="whitegrid")
20
 
21
  # load filtered data
 
121
  df_p.columns = [f"min entity: {mef}, max predicate: {mpf}" for mef, mpf in candidates]
122
  fig, axes = plt.subplots(2, 2, constrained_layout=True)
123
  fig.suptitle('Predicate Distribution over Different Configurations')
124
+ for (x, y), mpf in zip([(0, 0), (0, 1), (1, 0), (1, 1)], parameters_max_p_freq):
125
+ _df = df_p[[f"min entity: {mef}, max predicate: {mpf}" for mef in parameters_min_e_freq]]
126
+ _df.columns = [f"min entity: {mef}" for mef in parameters_min_e_freq]
127
  ax = sns.lineplot(ax=axes[x, y], data=_df, linewidth=1)
128
  if mpf != 100:
129
  ax.legend_.remove()
 
138
  df_e.columns = [f"min entity: {mef}, max predicate: {mpf}" for mef, mpf in candidates]
139
  fig, axes = plt.subplots(2, 2, constrained_layout=True)
140
  fig.suptitle('Entity Distribution over Different Configurations')
141
+ for (x, y), mpf in zip([(0, 0), (0, 1), (1, 0), (1, 1)], parameters_max_p_freq):
142
+ _df = df_e[[f"min entity: {mef}, max predicate: {mpf}" for mef in parameters_min_e_freq]]
143
+ _df.columns = [f"min entity: {mef}" for mef in parameters_min_e_freq]
144
  ax = sns.lineplot(ax=axes[x, y], data=_df, linewidth=1)
145
  ax.set(xscale='log')
146
  if mpf != 100: