Comments (8)
Off the top of my head, we put the -1 there to not include the node itself in its own k-nn neighbors set. We do the same when building TSP graphs.
@amauriholanda, can you verify/demonstrate this bug via, e.g., this notebook: https://github.com/graphdeeplearning/benchmarking-gnns/blob/master/visualization/superpixels_visualization_mnist.ipynb
First, the self-loop produces 0, but what we want is the largest similarity value(0 is the minimum one among all values)
benchmarking-gnns/data/superpixels.py
Lines 46 to 49 in 92c762a
Second, you cannot distinguish the value produced by
np.argpartition
, values larger than knns[new_kth]
do not sort, so there is no reason to drop the last value.benchmarking-gnns/data/superpixels.py
Lines 59 to 60 in 92c762a
That's my opinion, what do you think about this?
from benchmarking-gnns.
Hi @amauriholanda, thank you for your interest in our work. Actually the original code in the file data/superpixels.py does not miss the nearest neighbor.
Here is the output of getting "k-nearest neighbor distances" for first node for first graph in the MNIST testset.
You may notice the original code implementation (first print(..)
statement result) is able to get the node with distance 0.1045919
from the first node.
--
You can verify this yourself by playing with the notebook inside visualizations dir of this repo. The .pkl
file used in the notebook is from the source project here.
from benchmarking-gnns.
Thanks for your answer.
But the entries in the adj. matrix are exponentiated (gaussian kernel). Thus, the nearest neighbor corresponds to the entry with largest value, right?! In your example, it is the value 0.50751934, which isn't in the printing with the original code.
Let me reformulate my question: Why are you leaving the last column out in the piece of code below?
knns = np.argpartition(A, new_kth - 1, axis=-1)[:, new_kth:-1]
I mean... you only get the samples from new_kth up to second last value, right?!
from benchmarking-gnns.
Thanks for your answer.
But the entries in the adj. matrix are exponentiated (gaussian kernel). Thus, the nearest neighbor corresponds to the entry with largest value, right?! In your example, it is the value 0.50751934, which isn't in the printing with the original code.
Let me reformulate my question: Why are you leaving the last column out in the piece of code below?
knns = np.argpartition(A, new_kth - 1, axis=-1)[:, new_kth:-1]
I mean... you only get the samples from new_kth up to second last value, right?!
Yes, I also find this strange, I think we should change it to include the whole last part.
from benchmarking-gnns.
Off the top of my head, we put the -1 there to not include the node itself in its own k-nn neighbors set. We do the same when building TSP graphs.
@amauriholanda, can you verify/demonstrate this bug via, e.g., this notebook: https://github.com/graphdeeplearning/benchmarking-gnns/blob/master/visualization/superpixels_visualization_mnist.ipynb
from benchmarking-gnns.
Hi @chaitjo,
Thanks for the reply. I see your point. And actually that was my first guess. But you remove the node itself when you compute the adjacency matrix here (method compute_adjacency_matrix_images
):
A[np.diag_indices_from(A)] = 0
Btw, this is a small thing. I don't believe it would lead to any significant difference in the results. I realized that when I independently tried to generate the MNIST data following the paper guidelines.
Anyway, I might take a look at your visualization notebook later.
Best.
from benchmarking-gnns.
We can look into this in more detail in the coming weeks and get back to you, @amauriholanda @hust-nj.
from benchmarking-gnns.
I am not sure if we investigated deeply after this discussion, but we were pretty confident that our superpixel graphs were being constructed as intended (i.e. taking the nearest neighbors instead of furthest neighbors) after we visualized them for both MNIST and CIFAR10. We have included the notebook.
Also, here is a related issue on superpixel graphs: #22
Let us know if further discussion is warranted...
from benchmarking-gnns.
Related Issues (20)
- Where is the implementation of `Graph Size Normalization`? HOT 1
- Are MNIST and CIFAR10 Directed or Undirected Graphs? HOT 1
- Questin About semisupervised_MNIST_CIFAR10 dataset HOT 6
- The ZINC dataset can't be download. HOT 1
- Explanation of Node Classification Tasks HOT 1
- HELP: A question regarding the implementation of the GatedGCN layer HOT 1
- The possibility of having 2D node features HOT 1
- Can I install the benchmark for Win 10? THANK YOU SO MUCH!
- An issue in Reproducibility HOT 3
- Install in different environment HOT 1
- WARNING:root:NaN or Inf found in input tensor. HOT 1
- When I run the superpixel graph_classification experiment, I got the error"'Column' object has no attribute 'deferred_dtype'" HOT 1
- Can you share the code about how to convert SMILES to .pkl file for zinc dataset?
- Are two ZINC download links the same?
- dgl reaches 1.0
- Issue with AttributeError: 'DGLGraph' object has no attribute 'adjacency_matrix_scipy' HOT 1
- How to fix this bug? HOT 1
- dgl version changed and we cannot even start running
- issue about sigma function in superpixel.py HOT 1
- About the ZINC evaluation
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 benchmarking-gnns.