Comments (9)
Disjoint mode solves exactly the problem of having to work with ragged tensors. I have looked into tf.ragged several times since I started this project, but there's always some problem that makes it impossible to move the whole framework to a ragged representation of graphs.
This way of representing graph is not only limited to the TU data, but is a fairly common way of representing graphs (also sometimes called ad "edge list"... it's all the same, really). The new OGB datasets are represented like this, for instance, and also many network datasets found online.
I think it's pretty convenient, and I don't see a clear advantage of batch mode over disjoint, especially because it is impossible to store batch data as sparse matrices.
Other frameworks like Pytorch Geometric also use disjoint mode for basically all of their layers.
So let's say that you have two graphs with a different number of nodes, stored in lists of matrices:
A_list = [A_1, A_2]
X_list = [X_1, X_2]
You can convert them to batch mode (all graphs have the same size):
from spektral.utils.data import numpy_to_batch
A_batch, X_batch = numpy_to_batch(A_list, X_list)
Or you can convert them to disjoint mode:
from spektral.utils.data import numpy_to_disjoint
A_disjoint, X_disjoint, I_disjoint = numpy_to_disjoint(A_list, X_list)
Note that I_disjoint
is only needed for pooling, it tells you which nodes belong to which sub-graph.
I hope that answers your doubts.
Cheers,
D
from spektral.
Sure! If it's a proper Layer you can put it in layers/base.py
, whereas for utility functions you can modify/create files in layers/ops/
.
from spektral.
Alright, I believe all my implementations have now been merged into the development branch and this issue can be closed.
Now that I feel comfortable with this framework, I'd really like to contribute more. Is there any to-do list I can consult to help with further development?
from spektral.
FYI I have just pushed to develop
a MessagePassing class that should make it easier to implement single-mode layers.
from spektral.
Hi,
I'd be happy to add your code to the framework. I should probably improve the contribution guidelines, here's more or less what it would be good to have:
- Message-passing layers should go in their own files under
layers.convolutional
; - Make sure that your layer has a
preprocess()
static method if there is any pre-processing to be done to the adjacency matrix; - Make sure that all functions needed for Keras are implemented (your layer should extend GraphConv);
- SortPool should be added as a class in
layers/pooling/globalpool.py
; - See the documentation in the other layers for how to format docstrings (it's important that the format is that same so that the docs can be built automatically);
Tests are a bit different. It's better if you copy-paste what I did for other methods, or just open a PR and I'll add the test cases myself.
I've never had big PRs so it's better if we work together on this one :D
Just open a PR and we'll go from there.
Cheers,
Daniele
from spektral.
Okay, wonderful!
I will give myself a week to familiarise myself with your codebase and will open a PR soon thereafter :)
Best,
Levi
from spektral.
Is there any place where I can put utility layers used for convolutional layers without them cluttering the convolutional layer docs?
from spektral.
Thanks again for contributing! I will be merging the new layers into master
soon and pushing them to PyPi as well.
I would say that any additional convolutional or pooling layers would be a good contribution. I have thought about creating a general abstraction for message-passing layers for a while now, I will take this chance to start working on it over the following days. This should make future contributions easier.
I am also starting a TODO list in Projects to keep track of what is missing in the library.
Cheers,
Daniele
from spektral.
Very nice!
Out of curiosity, is disjoint mode supposed to be an internal data storage format, mainly served by spektral's data loader etc or do we expect many users to have their own data in that format? Because apart from TU, I am not aware of many datasets having that format.
Furthermore, I expect that many users will have batch-mode signal and adjacency data with the node dimension being ragged. It may be worth providing methods that allow to work with graph datasets that have a ragged node dimension.
To that end, I think either looking into tf.RaggedTensor or providing a function that creates batches of graphs with same size might be useful.
Best,
Levi
from spektral.
Related Issues (20)
- Adding the Edges in GIN model HOT 1
- Adding the DGIN convolution ?
- Adding D-MPNNConv
- Inquiry about the usability of graph classification HOT 1
- How to evaluate a graph regression model with new data? HOT 4
- Problem using GNNExplainer HOT 4
- Dependency Issue on Mac M2 Pro HOT 2
- model.evalute() reprodusibility problem HOT 5
- Columns and DataType Not Explicitly Set on line 55 of io.py
- load data to fit the model (Spektral & Keras) HOT 2
- Is it require to create an adjacency matrix? HOT 2
- 'GATConv' object is not callable
- How to use Single Mode when I am training for the same graph structure HOT 1
- How to match real label with predicted y after using model.predict() with disjointloader? HOT 2
- Code breaks when moving from Linux to MacOS HOT 2
- Unable to load Cora dataset using colab HOT 7
- No unsupvervised loss in GraphSAGE convolution layer HOT 1
- No unsupervised loss for GINConv HOT 1
- segment_id is out of range
- How to do the model.summary() after I have create a model? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spektral.