Giter Club home page Giter Club logo

ggnn.pytorch's Introduction

A PyTorch Implementation of GGNN

This is a PyTorch implementation of the Gated Graph Sequence Neural Networks (GGNN) as described in the paper Gated Graph Sequence Neural Networks by Y. Li, D. Tarlow, M. Brockschmidt, and R. Zemel. This implementation gets 100% accuracy on node-selection bAbI task 4, 15, and 16. Their official implementation are available in the yujiali/ggnn repo on GitHub.

What is GGNN?

  • Solve graph-structured data and problems
  • A gated propagation model to compute node representations
  • Unroll recurrence for a fixed number of steps and use backpropogation through time
  • An output model to make predictions on nodes

Requirements

  • python==2.7
  • PyTorch>=0.2

Run

Train and test the GGNN:

python main.py --cuda (use GPUs or not)

Suggesting configurations for each task:

# task 4
python main.py --task_id 4 --state_dim 4 --niter 10
# task 15
python main.py --task_id 15 --state_dim 5 --niter 10
# task 16
python main.py --task_id 16 --state_dim 10 --niter 150

Results

I followed the paper, randomly picking only 50 training examples for training. Performances are evaluated on 50 random validation examples.

bAbI Task Performance
4 100%
15 100%
16 100%

Here's an example of bAbI deduction task (task 15)

Disclaimer

The data processing codes are from official implementation yujiali/ggnn.

TODO

  • GraphLevel Output

References

ggnn.pytorch's People

Contributors

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

ggnn.pytorch's Issues

Question about Graph-Level output

In your todo list, you list out the task : GraphLevel Output, then I assume that you haven't implemented this task in the current code set.

But so far when I read the source code, I can see that you nearly finish it.
This line: https://github.com/JamesChuanggg/ggnn.pytorch/blob/0c7897fe9b05e9b4f9a963ff55bd3ad917ea734e/model.py#L123 is to compute the vector representation of the graph that will use to predict the target class and compute the CrossEntropy loss in the latter step. In the current Babi tasks, the prediction target is the label of the node (in most of the task). But for the graph-level output, e.g graph classification, I guess what we need to do is instead of predicting the label of the node, we predict the label of the whole graph, and with the current set of code, we have 99% of the code ready, no need to do more. Not sure If I understand this correctly, please help me to clarify.

Creating adjacency matrix

For the part to create the adjacency matrix, it's not clear to me.

For example, we have 2 edges:
2 1 3
1 1 2

Then from the code implementation here:
https://github.com/JamesChuanggg/ggnn.pytorch/blob/master/utils/data/dataset.py#L79

Supposed there are 4 node types and 2 edges types, then Row = 4 , Column = 4 X 2 X 2 = 16
Then we get the 4 X 16 Matrix M :
[[0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0.]
[1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0.]
[0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]]

Where:
M[2][1] = 1
M[1][10] = 1
M[1][0] = 1
M[0][9] = 1

What kind of adjacency matrix like this? I've checked the paper, it doesn't mention anything similar to this. I suspect that this is the matrix from Figure 1, section 3.2 of the paper that illustrates how nodes in the graph communicate with each other, in this case, it should be a 4 X 8 Matrix, not 4 X 16.

Please help me to enlighten my understanding.
Thanks!!!

Poor performance on Task19

According to the paper, this should achieve 97% acc on task19. which I can only get around 30%.
Did you test on the task19?

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.