Skip to content

loginaway/Metapath2vec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Metapath2vec

This is a Tensorflow implementation of Metapath2vec: Scalable Representation Learning for Heterogeneous Networks.

The author of the paper also released the source code and dataset. If you want to replicate the experimental results, please use the author's code.

For any clarification, comments or suggestions please create an issue or contact loginaway@gmail.com.

Dependencies

​ -> Dependencies can be installed using requirements.txt.

​ -> Install the dependencies by pip3 install -r requirements.txt.

Dataset

​ -> The input for this code is a text file with each line being a meta-walk, an example is put below.

a1312 b1235 c12 d0981 c1563 b123 a1000 b1222 …

​ where each node is represented by its type (an alphabet) and its number within the typeset. Note that this implementation will generate embeddings for all the nodes that occur in the text file.

​ -> As an example, you can refer to file walks.txt.

Train Metapath2vec embeddings

​ -> To start training, you can run

python metapath2vec.py -file walks.txt -embed_dim 64 -epoch 10 -types ac -outname embeddings

​ where -file specifies the dataset, -types ac gives a description of all the types appearing in the dataset (i.e. nodes start with 'a' or 'c'). Please note that here walks.txt is only an example showing the format of the training file. If you want to train other files (or replicate the author's result), please generate your own meta-randomwalk sequences in the same form.

​ -> Our code has many other options. Run python metapath2vec.py -h for more information.

Output

​ -> The generated embeddings will be put in ./output/.

About

A fast tensorflow implementation of Metapath2vec.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages