init
Browse files- README.md +111 -51
- fewshot_link_prediction.py +2 -2
- stats.py +5 -1
README.md
CHANGED
@@ -35,75 +35,76 @@ An example of `test` of `nell` looks as follows.
|
|
35 |
|
36 |
## Statistics on the NELL test split
|
37 |
|
38 |
-
|
|
|
39 |
|
40 |
| entity_type | tail | head |
|
41 |
|:-------------------------|-------:|-------:|
|
42 |
-
| geopoliticallocation | 14 | 24 |
|
43 |
-
| crustacean | 25 | 11 |
|
44 |
-
| amphibian | 0 | 2 |
|
45 |
-
| criminal | 1 | 0 |
|
46 |
-
| arthropod | 41 | 32 |
|
47 |
| videogame | 0 | 4 |
|
48 |
-
|
|
49 |
-
| animal | 30 | 97 |
|
50 |
-
| politician | 58 | 23 |
|
51 |
| organization | 2 | 32 |
|
52 |
-
|
|
53 |
-
|
|
54 |
-
| personmexico | 20 | 13 |
|
55 |
-
| personus | 6 | 1 |
|
56 |
-
| automobilemaker | 54 | 274 |
|
57 |
-
| chemical | 0 | 1 |
|
58 |
| astronaut | 1 | 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
| company | 147 | 1 |
|
60 |
-
|
|
61 |
-
| software | 0 | 42 |
|
62 |
-
| biotechcompany | 11 | 0 |
|
63 |
-
| mammal | 0 | 23 |
|
64 |
| product | 0 | 62 |
|
65 |
-
|
|
|
|
|
|
|
|
66 |
| sport | 74 | 93 |
|
67 |
-
|
|
68 |
-
|
|
69 |
-
| hobby | 0 | 10 |
|
70 |
-
| vehicle | 0 | 2 |
|
71 |
-
| director | 1 | 0 |
|
72 |
| planet | 1 | 0 |
|
|
|
|
|
|
|
73 |
| athlete | 59 | 34 |
|
74 |
-
|
|
75 |
-
|
|
76 |
-
| politicianus | 360 | 352 |
|
77 |
| automobilemodel | 0 | 100 |
|
78 |
| coffeedrink | 0 | 11 |
|
79 |
-
|
|
80 |
-
| person | 96 | 14 |
|
81 |
-
| bodypart | 69 | 0 |
|
82 |
-
| female | 3 | 3 |
|
83 |
-
| journalist | 1 | 0 |
|
84 |
-
| geopoliticalorganization | 17 | 1 |
|
85 |
-
| visualizablescene | 3 | 3 |
|
86 |
-
| professor | 0 | 1 |
|
87 |
-
| reptile | 0 | 4 |
|
88 |
-
| drug | 0 | 1 |
|
89 |
-
| stateorprovince | 0 | 38 |
|
90 |
-
| beverage | 0 | 27 |
|
91 |
-
| school | 0 | 11 |
|
92 |
-
| county | 4 | 10 |
|
93 |
-
| male | 5 | 3 |
|
94 |
| celebrity | 2 | 4 |
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
| personaustralia | 5 | 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
| sportsteam | 0 | 295 |
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
| island | 0 | 1 |
|
100 |
-
|
|
101 |
-
|
|
102 |
-
| personeurope | 1 | 0 |
|
103 |
-
| vegetable | 0 | 8 |
|
104 |
-
| legume | 0 | 1 |
|
105 |
|
106 |
-
- Relation Types
|
107 |
|
108 |
| relation | relation |
|
109 |
|:-----------------------------------------------|-----------:|
|
@@ -119,6 +120,65 @@ An example of `test` of `nell` looks as follows.
|
|
119 |
| concept:sportsgamesport | 74 |
|
120 |
| concept:teamcoach | 341 |
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
### Citation Information
|
124 |
```
|
|
|
35 |
|
36 |
## Statistics on the NELL test split
|
37 |
|
38 |
+
|
39 |
+
- Entity Types (nell)
|
40 |
|
41 |
| entity_type | tail | head |
|
42 |
|:-------------------------|-------:|-------:|
|
|
|
|
|
|
|
|
|
|
|
43 |
| videogame | 0 | 4 |
|
44 |
+
| crustacean | 25 | 11 |
|
|
|
|
|
45 |
| organization | 2 | 32 |
|
46 |
+
| invertebrate | 43 | 14 |
|
47 |
+
| agriculturalproduct | 0 | 87 |
|
|
|
|
|
|
|
|
|
48 |
| astronaut | 1 | 0 |
|
49 |
+
| vegetable | 0 | 8 |
|
50 |
+
| geopoliticallocation | 14 | 24 |
|
51 |
+
| person | 96 | 14 |
|
52 |
+
| drug | 0 | 1 |
|
53 |
+
| arthropod | 41 | 32 |
|
54 |
+
| location | 2 | 0 |
|
55 |
| company | 147 | 1 |
|
56 |
+
| female | 3 | 3 |
|
|
|
|
|
|
|
57 |
| product | 0 | 62 |
|
58 |
+
| chemical | 0 | 1 |
|
59 |
+
| legume | 0 | 1 |
|
60 |
+
| county | 4 | 10 |
|
61 |
+
| mlsoftware | 0 | 1 |
|
62 |
| sport | 74 | 93 |
|
63 |
+
| fruit | 0 | 1 |
|
64 |
+
| personeurope | 1 | 0 |
|
|
|
|
|
|
|
65 |
| planet | 1 | 0 |
|
66 |
+
| mammal | 0 | 23 |
|
67 |
+
| professor | 0 | 1 |
|
68 |
+
| criminal | 1 | 0 |
|
69 |
| athlete | 59 | 34 |
|
70 |
+
| insect | 270 | 230 |
|
71 |
+
| school | 0 | 11 |
|
|
|
72 |
| automobilemodel | 0 | 100 |
|
73 |
| coffeedrink | 0 | 11 |
|
74 |
+
| food | 0 | 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
| celebrity | 2 | 4 |
|
76 |
+
| biotechcompany | 11 | 0 |
|
77 |
+
| animal | 30 | 97 |
|
78 |
+
| visualizablescene | 3 | 3 |
|
79 |
+
| politician | 58 | 23 |
|
80 |
+
| software | 0 | 42 |
|
81 |
+
| sportsgame | 0 | 74 |
|
82 |
+
| grain | 0 | 2 |
|
83 |
+
| city | 161 | 42 |
|
84 |
| personaustralia | 5 | 4 |
|
85 |
+
| politicianus | 360 | 352 |
|
86 |
+
| hobby | 0 | 10 |
|
87 |
+
| arachnid | 6 | 1 |
|
88 |
+
| country | 317 | 27 |
|
89 |
+
| male | 5 | 3 |
|
90 |
+
| personnorthamerica | 3 | 1 |
|
91 |
| sportsteam | 0 | 295 |
|
92 |
+
| stateorprovince | 0 | 38 |
|
93 |
+
| personus | 6 | 1 |
|
94 |
+
| coach | 245 | 1 |
|
95 |
+
| director | 1 | 0 |
|
96 |
+
| automobilemaker | 54 | 274 |
|
97 |
+
| reptile | 0 | 4 |
|
98 |
+
| journalist | 1 | 0 |
|
99 |
+
| vehicle | 0 | 2 |
|
100 |
+
| bodypart | 69 | 0 |
|
101 |
+
| amphibian | 0 | 2 |
|
102 |
+
| beverage | 0 | 27 |
|
103 |
| island | 0 | 1 |
|
104 |
+
| geopoliticalorganization | 17 | 1 |
|
105 |
+
| personmexico | 20 | 13 |
|
|
|
|
|
|
|
106 |
|
107 |
+
- Relation Types (nell)
|
108 |
|
109 |
| relation | relation |
|
110 |
|:-----------------------------------------------|-----------:|
|
|
|
120 |
| concept:sportsgamesport | 74 |
|
121 |
| concept:teamcoach | 341 |
|
122 |
|
123 |
+
- Vocab Size (nell): 68544
|
124 |
+
|
125 |
+
- Entity Types (nell_filter)
|
126 |
+
|
127 |
+
| entity_type | tail | head |
|
128 |
+
|:-------------------------|-------:|-------:|
|
129 |
+
| videogame | 0 | 4 |
|
130 |
+
| organization | 2 | 32 |
|
131 |
+
| astronaut | 1 | 0 |
|
132 |
+
| geopoliticallocation | 8 | 24 |
|
133 |
+
| person | 96 | 0 |
|
134 |
+
| drug | 0 | 1 |
|
135 |
+
| company | 144 | 1 |
|
136 |
+
| female | 3 | 3 |
|
137 |
+
| product | 0 | 62 |
|
138 |
+
| county | 4 | 10 |
|
139 |
+
| personeurope | 1 | 0 |
|
140 |
+
| planet | 1 | 0 |
|
141 |
+
| professor | 0 | 1 |
|
142 |
+
| criminal | 1 | 0 |
|
143 |
+
| athlete | 59 | 0 |
|
144 |
+
| school | 0 | 11 |
|
145 |
+
| automobilemodel | 0 | 100 |
|
146 |
+
| celebrity | 2 | 4 |
|
147 |
+
| biotechcompany | 10 | 0 |
|
148 |
+
| visualizablescene | 3 | 3 |
|
149 |
+
| politician | 58 | 23 |
|
150 |
+
| software | 0 | 42 |
|
151 |
+
| city | 161 | 42 |
|
152 |
+
| personaustralia | 5 | 0 |
|
153 |
+
| politicianus | 360 | 352 |
|
154 |
+
| country | 91 | 27 |
|
155 |
+
| male | 5 | 1 |
|
156 |
+
| personnorthamerica | 3 | 0 |
|
157 |
+
| sportsteam | 0 | 295 |
|
158 |
+
| stateorprovince | 0 | 38 |
|
159 |
+
| personus | 6 | 1 |
|
160 |
+
| coach | 245 | 0 |
|
161 |
+
| director | 1 | 0 |
|
162 |
+
| automobilemaker | 54 | 273 |
|
163 |
+
| journalist | 1 | 0 |
|
164 |
+
| island | 0 | 1 |
|
165 |
+
| geopoliticalorganization | 7 | 1 |
|
166 |
+
| personmexico | 20 | 0 |
|
167 |
+
|
168 |
+
- Relation Types (nell_filter)
|
169 |
+
|
170 |
+
| relation | relation |
|
171 |
+
|:-----------------------------------------------|-----------:|
|
172 |
+
| concept:automobilemakerdealersincity | 177 |
|
173 |
+
| concept:automobilemakerdealersincountry | 96 |
|
174 |
+
| concept:geopoliticallocationresidenceofpersion | 143 |
|
175 |
+
| concept:politicianusendorsespoliticianus | 386 |
|
176 |
+
| concept:producedby | 209 |
|
177 |
+
| concept:teamcoach | 341 |
|
178 |
+
|
179 |
+
Vocab Size (nell_filter)
|
180 |
+
53887
|
181 |
+
|
182 |
|
183 |
### Citation Information
|
184 |
```
|
fewshot_link_prediction.py
CHANGED
@@ -5,7 +5,7 @@ import datasets
|
|
5 |
logger = datasets.logging.get_logger(__name__)
|
6 |
_DESCRIPTION = """Few shots link prediction dataset. """
|
7 |
_NAME = "fewshot_link_prediction"
|
8 |
-
_VERSION = "0.0.
|
9 |
_CITATION = """
|
10 |
@inproceedings{xiong-etal-2018-one,
|
11 |
title = "One-Shot Relational Learning for Knowledge Graphs",
|
@@ -28,7 +28,7 @@ _CITATION = """
|
|
28 |
|
29 |
_HOME_PAGE = "https://github.com/asahi417/relbert"
|
30 |
_URL = f'https://huggingface.co/datasets/relbert/{_NAME}/resolve/main/data'
|
31 |
-
_TYPES = ["
|
32 |
_URLS = {i: {
|
33 |
str(datasets.Split.TRAIN): [f'{_URL}/{i}.train.jsonl'],
|
34 |
str(datasets.Split.VALIDATION): [f'{_URL}/{i}.validation.jsonl'],
|
|
|
5 |
logger = datasets.logging.get_logger(__name__)
|
6 |
_DESCRIPTION = """Few shots link prediction dataset. """
|
7 |
_NAME = "fewshot_link_prediction"
|
8 |
+
_VERSION = "0.0.4"
|
9 |
_CITATION = """
|
10 |
@inproceedings{xiong-etal-2018-one,
|
11 |
title = "One-Shot Relational Learning for Knowledge Graphs",
|
|
|
28 |
|
29 |
_HOME_PAGE = "https://github.com/asahi417/relbert"
|
30 |
_URL = f'https://huggingface.co/datasets/relbert/{_NAME}/resolve/main/data'
|
31 |
+
_TYPES = ["nell_filter", "nell", "wiki"]
|
32 |
_URLS = {i: {
|
33 |
str(datasets.Split.TRAIN): [f'{_URL}/{i}.train.jsonl'],
|
34 |
str(datasets.Split.VALIDATION): [f'{_URL}/{i}.validation.jsonl'],
|
stats.py
CHANGED
@@ -2,7 +2,7 @@ import pandas as pd
|
|
2 |
from datasets import load_dataset
|
3 |
|
4 |
for _type in ['nell', 'nell_filter']:
|
5 |
-
data = load_dataset("fewshot_link_prediction", _type, split='test')
|
6 |
df = data.to_pandas()
|
7 |
|
8 |
print(f"\nEntity Types ({_type})")
|
@@ -15,4 +15,8 @@ for _type in ['nell', 'nell_filter']:
|
|
15 |
print(f"\nRelation Types ({_type})")
|
16 |
print(df.groupby("relation")['relation'].count().to_markdown())
|
17 |
|
|
|
|
|
|
|
|
|
18 |
|
|
|
2 |
from datasets import load_dataset
|
3 |
|
4 |
for _type in ['nell', 'nell_filter']:
|
5 |
+
data = load_dataset("relbert/fewshot_link_prediction", _type, split='test')
|
6 |
df = data.to_pandas()
|
7 |
|
8 |
print(f"\nEntity Types ({_type})")
|
|
|
15 |
print(f"\nRelation Types ({_type})")
|
16 |
print(df.groupby("relation")['relation'].count().to_markdown())
|
17 |
|
18 |
+
print(f"\nVocab Size ({_type})")
|
19 |
+
with open(f"data/{_type}.vocab.txt") as f:
|
20 |
+
length = len([i for i in f.read().split('\n') if len(i) > 0])
|
21 |
+
print(length)
|
22 |
|