Open tanwimallick opened 4 years ago
According to the paper, the spatial embeddings (SE file) are bootstrapped with node2vec and then trained together with the model.
import networkx as nx
from node2vec import Node2Vec
graph = nx.from_numpy_matrix(adj_mx)
# Precompute probabilities and generate walks
node2vec = Node2Vec(graph, dimensions=64, walk_length=30, num_walks=200, workers=1)
# Embed nodes
model = node2vec.fit(window=10, min_count=1, batch_words=4)
model.wv.save_word2vec_format('SE_new.txt')
In practise however, you could also use a coordinate-based initialisation, since training the spatial embedding is part of the training procedure.
Edit: This script is less optimal than the results of the authors.
This was before the authors published their results on METR-LA dataset (+source). Additionally, I'm using another node2vec implementation with slightly different params.
I have uploaded the code
Could you please share the code snippet to create the SE file?