Skip to content

What does the index of the embedding mean? #138

Answered by RemyLau
vadhoob asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @vadhoob, thanks for your interest in using PecanPy! In this case, the index of emd will be consistent with the graph g, i.e., the first row in the emd matrix correspond to the embedding vector of the first node in g.

The relevant code is as follows

return w2v.wv[self.nodes]

where w2v is the trained word2vec object, and w2v.wv is the corresponding keyedvectors. This keyedvectors can be indexed by the corresponding words (i.e., node IDs in the graph). Thus, using the node IDs self.nodes of the graph g via w2v.wv[self.nodes] produces an embedding matrix whose node order is consistent with the graph.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@vadhoob
Comment options

@RemyLau
Comment options

@vadhoob
Comment options

Answer selected by vadhoob
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants