GithubHelp home page GithubHelp logo

daehankim / vgae_pytorch Goto Github PK

View Code? Open in Web Editor NEW
346.0 2.0 70.0 5.04 MB

This repository implements variational graph auto encoder by Thomas Kipf.

License: MIT License

Python 100.00%
pytorch vgae link-prediction

vgae_pytorch's Introduction

Variational Graph Auto-encoder in Pytorch

This repository implements variational graph auto-encoder by Thomas Kipf. For details of the model, refer to his original tensorflow implementation and his paper.

Requirements

  • Pytorch
  • python 3.x
  • networkx
  • scikit-learn
  • scipy

How to run

  • Specify your arguments in args.py : you can change dataset and other arguments there
  • run python train.py

Notes

  • The dataset is the same as what Kipf provided in his original implementation. Thus I used his preprocessing code as-is(maybe with minor modification).
  • Per-epoch training time is a bit slower then the original implementation.(0.2 sec/epoch --> 0.9 sec/epoch)
  • Train accuracy, validation(test) average precision, auroc are similar to those of the original. (over 90% for both AP and roc)
  • Dropout is not implemented now.
  • Feel free to report some inefficiencies in the code! (It's just initial version so may have much room for pytorch-adaptation)

vgae_pytorch's People

Contributors

daehankim avatar

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  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  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

vgae_pytorch's Issues

About Node Classification

Hello, Thanks for releasing your work! I have seen that you said you use GAE for node classification tasks but can not get good results, have you found why? And could you plz release the code for node classification?

Can this be used for clustering the nodes?

Hello, thank you for your great work.
I'm new to graph networks, and I would appreciate it if you'd explain to me if this model can be used for clustering i.e. community detection? if not, can you recommend ways to employ a GCN or a GAE for community detection?

About normalization constants norm and weight_tensor

Hi,

I am having some trouble understanding why are we using the normalization constants norm and weight_tensor and why they are defined in this way. Could you provide some intuition behind this normalization?

norm = adj.shape[0] * adj.shape[0] / float((adj.shape[0] * adj.shape[0] - adj.sum()) * 2)
pos_weight = float(adj.shape[0] * adj.shape[0] - adj.sum()) / adj.sum()
weight_mask = adj_label.to_dense().view(-1) == 1
weight_tensor = torch.ones(weight_mask.size(0)) 
weight_tensor[weight_mask] = pos_weight

Thanks a lot for your help beforehand!

Recreating the adjacancey matrix using VGAE cocept

Hi, I have been trying to recreate the adjacency of my sparse matrix using the same VGAE concept. I am not able to recreate the adjacency matrix. Do you think there is any preprocessing is necessary for such sparse graphs? Please let me know. I am attaching the data and code for your reference. I am also attaching the results I am able to reproduce using this code. Please feel free to go through the code and suggest necessary changes. Thank you!

P.S: The graphs are unidirectional. And do not have self-loops as well.

[states.zip](https://github.com/Daehan
adjacency_pred_vgae .txt
Kim/vgae_pytorch/files/8883726/states.zip)

image (4)
image (3)
image (2)
image (1)

a small problem

kl_divergence = 0.5/ A_pred.size(0) * (1 + 2*model.logstd - model.mean**2 - torch.exp(model.logstd)).sum(1).mean()
torch.exp(model.logstd)**2 ?

what type is the data

Excuse me, I have a question about the format of data. The extensions of these data files are 'x','tx', 'allx','graph' which I haven't seen before. Further more, what I can see is shown in the following picture when I open them with Pycharm.
3YL {3PQ05)GVOX9_BWA~%D

more graphs train

Hello, now if I have many graphs, how can train these data? It seems that the code can just train on one graph data.

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.