scikit-kge
scikit-kge copied to clipboard
Accessing of embeddings after training
How do you access the embedding vectors after the training of the model? The documentation is unclear on this matter.
I have the same issue. Were you able to figure it out?
I'm sorry, I didn't manage to figure it out and decided not to use this package.
For anyone who comes across this, you can access the embeddings as follows (based on the example from the readme). They're parameter objects belonging to the model.
# embeddings for entities; can use like numpy matrix
entity_embeds = trainer.model.E
print(entity_embeds[some_entity_id])
# embeddings for relations
relation_embeds = trainer.model.R
print(relation_embeds[some_relation_id])