DeepGraphLearning / KnowledgeGraphEmbedding

MIT License
1.24k stars 264 forks source link

Question about the embedding range (weight initialization and phase normalization) #9

Closed tabacof closed 5 years ago

tabacof commented 5 years ago

Hello, first of all many thanks for providing the source code alongside the paper.

I was comparing the implementation of RotatE against the paper and I found something which seems quite important, the embedding range, which is defined as (gamma+2)/hidden_dim.

This raises two questions that could be related to each other:

  1. The paper says "Both the real and imaginary parts of the entity embeddings are uniformly initialized, and the phases of the relation embeddings are uniformly initialized between 0 and 2π.", while in the code both the entities and relations are initialized with Uniform(-embedding_range, embedding_range).
  2. The phase relation is divided by the embedding range in the metric implementation, while that does not seem explicitly mentioned in the paper from my reading.

Could you help me understand these two points, or maybe point out in the paper the explanation behind them?

Thank you very much.

Edward-Sun commented 5 years ago

Hi, thank you for your attention in our work. 1) Yes, they are both initialized with [-embedding_range, embedding_range]. We implement initialization in this way because we want a unified initialization approach across different KGE methods.

2) The embedding of relations is scaled to 0 to 2π before calculating the real parts and imaginary part. Along with 1), this constitutes a valid implementation of "Both the real and imaginary parts of the entity embeddings are uniformly initialized, and the phases of the relation embeddings are uniformly initialized between 0 and 2π."