chingyaoc / ggnn.pytorch Goto Github PK
View Code? Open in Web Editor NEWA PyTorch Implementation of Gated Graph Sequence Neural Networks (GGNN)
License: MIT License
A PyTorch Implementation of Gated Graph Sequence Neural Networks (GGNN)
License: MIT License
https://github.com/JamesChuanggg/ggnn.pytorch/blob/master/utils/data/dataset.py#L74-L75
annotation = np.zeros([n_nodes, n_annotation_dim])
annotation[target[1]-1][0] = 1
@JamesChuanggg Thank you!
i wanna to know how to save or extract the GraphLevel Output model and use the feature to apply on classification application,thanks
According to the paper, this should achieve 97% acc on task19. which I can only get around 30%.
Did you test on the task19?
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!!!
https://github.com/JamesChuanggg/ggnn.pytorch/blob/master/model.py#L29-L40
self.reset_gate = nn.Sequential(
nn.Linear(state_dim*3, state_dim),
nn.Sigmoid()
)
self.update_gate = nn.Sequential(
nn.Linear(state_dim*3, state_dim),
nn.Sigmoid()
)
self.tansform = nn.Sequential(
nn.Linear(state_dim*3, state_dim),
nn.Tanh()
)
@JamesChuanggg Thank you very much!
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.
https://github.com/JamesChuanggg/ggnn.pytorch/blob/master/utils/data/dataset.py#L72
for item in data_list:
edge_list = item[0]
target_list = item[1]
for target in target_list:
task_type = target[0]
Thank you very much!!
@JamesChuanggg
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.