hmdng
hmdng

Reputation: 11

Graph embedding on a dummy dataset

I am new to graph embeddings and I have been trying to embed a simple multi-directed graph with 5 nodes, with a symmetry between node 1 and 2. My assumption is that if node 1 and 2 are exactly symmetric (they are both linked to the same nodes with the same directions), they should have similar embeddings, but none of my 2 implementations reflected this. My graph looks like this:

enter image description here

I have first tried node2vec (G is my multi-directed graph created with networkx)

# Generate walks
node2vec = Node2Vec(G, dimensions=2, walk_length=8, num_walks=80, workers=2)
# Learn embeddings
model = node2vec.fit(window=5, min_count=1)

But my results do not coincide with my hypothesis, node 1 is most similar to node 3 which I do not understand. Is it a problem in the tuning of my parameters or is the topology of my graph too simple to have great results on it? (I did verify that my results are well labeled by using index_to_key). Here is the visualization of my obtained embeddings:

enter image description here

Second, I tried with simplE, an algorithm that generates embeddings of the relationship types (in my case there is only one type of relation), of the head nodes and of the tail nodes. From what I understand of this algorithm, the head embeddings and tail embeddings should also conserve the similarity between node 1 and 2. Here are the parameters I have chosen:

parser = argparse.ArgumentParser()
# description of the parameters
parser.add_argument('-ne', default=1000, type=int, help="number of epochs")
parser.add_argument('-lr', default=0.1, type=float, help="learning rate")
parser.add_argument('-reg_lambda', default=0.03, type=float, help="l2 regularization parameter")
parser.add_argument('-dataset', default="WN18", type=str, help="wordnet dataset")
parser.add_argument('-emb_dim', default=200, type=int, help="embedding dimension")
parser.add_argument('-neg_ratio', default=1, type=int, help="number of negative examples per positive example")
parser.add_argument('-batch_size', default=1415, type=int, help="batch size")
parser.add_argument('-save_each', default=50, type=int, help="validate every k epochs")

# choice of parameters
args = parser.parse_args(['-ne', '1000','-lr', '0.1','-reg', '0.03', '-dataset', 'DUMMY', '-emb_dim', '10', '-neg_ratio', '1', '-batch_size', '1', '-save_each', '50' ])

Again, my results do not reflect my hypothesis as node 1 and 2 are not close in my vector space for the head and tail embedding.

Upvotes: 1

Views: 314

Answers (0)

Related Questions