Code Monkey home page Code Monkey logo

daiquocnguyen / walk-transformer Goto Github PK

View Code? Open in Web Editor NEW
39.0 2.0 7.0 88.35 MB

From Random Walks to Transformer for Learning Node Embeddings (ECML-PKDD 2020) (In Pytorch and Tensorflow)

License: Apache License 2.0

Python 96.15% C++ 3.67% Makefile 0.18%
node-classification node-embeddings graph-embeddings graph-neural-networks inductive-node-embeddings unsupervised-node-embedding self-attention random-walk transformer pytorch-implementation

walk-transformer's Introduction

From Random Walks to Transformer for Learning Node EmbeddingsTwitter

GitHub top languageGitHub issues GitHub repo size GitHub last commit GitHub forks GitHub stars GitHub

  • This program provides the implementation of our unsupervised node embedding model SANNE as described in our paper whose central idea is to employ a transformer self-attention network to iteratively aggregate vector representations of nodes in sampled random walks.
  • SANNE is also used in an inductive setting to infer embeddings of new/unseen nodes adding to a given graph.

Usage

News

  • June 08, 2020: Update Pytorch (1.5.0) implementation. You should change to the log_uniform directory to perform make to build SampledSoftmax, and then add the log_uniform directory to your PYTHONPATH.
  • March 25, 2020: The Tensorflow implementation was completed one year ago and now it is out-of-date, caused by the change of Tensorflow from 1.x to 2.x. I will release the Pytorch implementation soon.

Requirements

  • Python 3
  • Pytorch 1.5 or
  • Tensorflow 1.6 and Tensor2Tensor 1.9
  • scikit-learn 0.21.3

Training

Examples for the Pytorch implementation:

$ python train_pytorch_SANNE.py --dataset cora --batch_size 64 --num_self_att_layers 2 --num_heads 2 --ff_hidden_size 256 --num_neighbors 4 --walk_length 8 --num_walks 32 --learning_rate 0.005 --model_name CORA_trans_att2_h2_nw32_lr0.005

$ python train_pytorch_SANNE_inductive.py --dataset cora --batch_size 64 --num_self_att_layers 2 --num_heads 2 --ff_hidden_size 256 --num_neighbors 4 --walk_length 8 --num_walks 32 --fold_idx 1 --learning_rate 0.005 --model_name CORA_ind_att2_h2_nw32_fold1_lr0.005

Cite

Please cite the paper whenever SANNE is used to produce published results or incorporated into other software:

@InProceedings{Nguyen2020SANNE,
	author={Dai Quoc Nguyen and Tu Dinh Nguyen and Dinh Phung},
	title={A Self-Attention Network based Node Embedding Model},
	booktitle={Proceedings of the European Conference on Machine Learning and Principles and Practice of Knowledge Discovery in Databases (ECML PKDD)},
	year={2020}
}

License

As a free open-source implementation, SANNE is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. All other warranties including, but not limited to, merchantability and fitness for purpose, whether express, implied, or arising by operation of law, course of dealing, or trade usage are hereby disclaimed. I believe that the programs compute what I claim they compute, but I do not guarantee this. The programs may be poorly and inconsistently documented and may contain undocumented components, features or modifications. I make no guarantee that these programs will be suitable for any application.

SANNE is licensed under the Apache License 2.0.

walk-transformer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

walk-transformer's Issues

About files in the data folder

Thanks for your paper and model code, I have benefited a lot.

I want to apply SANNE to my own data set, but I don't know the meaning of each file in the data folder. Could you take the cora data set as an example to explain how each file is obtained?

Thanks again!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.