KGE.data_utils
Functions
|
|
|
Convert the KG data into index |
|
Index the Knowledge Graph data. |
|
|
|
Split KG data into train and test |
Classes
|
Decorate an iterable object, returning an iterator which acts exactly like the original iterable, but prints a dynamically updating progressbar every time a value is requested. |
Class Inheritance Diagram

- KGE.data_utils.convert_kg_to_index(kg_data, ent2ind, rel2ind)[source]
Convert the KG data into index
- Parameters
kg_data (
np.array) – KG data to be convertedent2ind (
dict) – dictionary that map entity to indexrel2ind (
dict) – dictionary that map relation to index
- Returns
indexed KG data
- Return type
np.array
- KGE.data_utils.index_kg(kg_data)[source]
Index the Knowledge Graph data.
- Parameters
kg_data (
np.array) – KG data to be indexed- Returns
metadata of KG <br>
'ent2ind': dictionary that map entity to index'ind2ent': list that map index to entity'rel2ind': dictionary that map relation to index'ind2rel': list that map index to relation- Return type
dict
- KGE.data_utils.train_test_split_no_unseen(X, test_size, seed)[source]
Split KG data into train and test
Split KG data into train and test, this function guarantees that the entities in test data are also present in the train data.
- Parameters
X (
np.array) – KG data to be splittedtest_size (
intorfloat) – desired test size, ifint, represents the absolute test size, iffloat, represents the relative proportion.seed (
int) – random seed
- Returns
splitted train, test KG data
- Return type
np.array,np.array