thunlp / OpenKE

An Open-Source Package for Knowledge Embedding (KE)
3.76k stars 984 forks source link

IDs for entities/relations and their place in the embedding matrix #79

Closed Alekos92 closed 5 years ago

Alekos92 commented 5 years ago

I would like to ask about the ids used for representing entities and relations in training files.

Reading the provided datasets' files, I see that the indices are in ascending order from 0 to num of entities/relations - 1. Is that a requirement, or could we use some other form of IDs, for example some internal id of the knowledge graph?

Also, as I understand the embedding.vec.json file, the embeddings are provided in the same order as in entity2id.txt and relation2id.txt, is that correct? Would that work in case of random IDs?

ShulinCao commented 5 years ago
  1. It is a requirement that the indices must be in ascending order from 0 to num of entities/relations - 1.
  2. The embeddings are provided in the same order as in entity2id.txt and relation2id.txt. That wouldn't work in case of random IDs.
Alekos92 commented 5 years ago

Thank you very much for your prompt response!