apple2373 / metapath2vec

185 stars 59 forks source link

How to train the model using batch_size? #8

Open linbang opened 5 years ago

linbang commented 5 years ago

Looks like I need to modify “get_negative_samples” function in dataset.py. However, i meet some bugs that cant be fixed...

apple2373 commented 5 years ago

I don't remember much about my coding honestly, but I feel Tensorflow operation somehow forced me to use batch size of 1 because it does not support Heterogeneous negative sampling (equation 5 in the original paper). In the equation, we have to normalize with the same typed nodes only instead of all nodes, right? But when we use batch > 1 with multiple types, normalization constant is different for each batch. I think I could not do this with tf.nn.nce_loss, because they assume to normalize with the same constant for each element in the batch. Maybe I was wrong or they already fixed it, but this is what I can remember now.

linbang commented 5 years ago

i have the same idea, thank you very much!