|
1 | | -# Spectral Clustering with Graph Neural Networks for Graph Pooling |
2 | | - |
3 | | -<img src="./figs/mincutpool.png" width="400" height="200"> |
4 | | - |
5 | | -This code reproduces the experimental results obtained with the MinCutPool layer |
6 | | -as presented in the ICML 2020 paper |
7 | | - |
8 | | -[Spectral Clustering with Graph Neural Networks for Graph Pooling](https://arxiv.org/pdf/1907.00481.pdf) |
9 | | -F. M. Bianchi*, D. Grattarola*, C. Alippi |
10 | | - |
11 | | -The official implementation of the MinCutPool layer can be found in |
12 | | -[Spektral](https://graphneural.network/layers/pooling/#mincutpool). |
13 | | - |
14 | | -An implementation of MinCutPool for PyTorch is also available in |
15 | | -[Pytorch Geometric](https://pytorch-geometric.readthedocs.io/en/latest/modules/nn.html#torch_geometric.nn.dense.dense_mincut_pool). |
16 | | - |
17 | | -## Setup |
18 | | - |
19 | | -The code is based on Python 3.5, TensorFlow 1.15, and Spektral 0.1.2. |
20 | | -All required libraries are listed in `requirements.txt` and can be installed with |
21 | | - |
22 | | -```bash |
23 | | -pip install -r requirements.txt |
24 | | -``` |
25 | | - |
26 | | -## Image segmentation |
27 | | - |
28 | | -<img src="./figs/overseg_and_rag.png" width="700" height="150"> |
29 | | - |
30 | | -Run [Segmentation.py](https://github.com/FilippoMB/Spectral-Clustering-with-Graph-Neural-Networks-for-Graph-Pooling/blob/master/Segmentation.py) |
31 | | -to perform hyper-segmentation, generate a Region Adjacency Graph from the |
32 | | -resulting segments, and then cluster the nodes of the RAG graph with the |
33 | | -MinCutPool layer. |
34 | | - |
35 | | -## Clustering |
36 | | - |
37 | | -<img src="./figs/clustering_stats.png" width="600" height="250"> |
38 | | - |
39 | | -Run [Clustering.py](https://github.com/FilippoMB/Spectral-Clustering-with-Graph-Neural-Networks-for-Graph-Pooling/blob/master/Clustering.py) |
40 | | -to cluster the nodes of a citation network. The datasets `cora`, `citeseer`, and |
41 | | -`pubmed` can be selected. |
42 | | -Results are provided in terms of homogeneity score, completeness score, and |
43 | | -normalized mutual information (v-score). |
44 | | - |
45 | | -## Autoencoder |
46 | | - |
47 | | -<img src="./figs/ae_ring.png" width="400" height="200"> |
48 | | -<img src="./figs/ae_grid.png" width="400" height="200"> |
49 | | - |
50 | | -Run [Autoencoder.py](https://github.com/FilippoMB/Spectral-Clustering-with-Graph-Neural-Networks-for-Graph-Pooling/blob/master/Autoencoder.py) |
51 | | -to train an autoencoder with bottleneck and compute the reconstructed graph. It |
52 | | -is possible to switch between the `ring` and `grid` graphs, but also any other |
53 | | -[point clouds](https://pygsp.readthedocs.io/en/stable/reference/graphs.html?highlight=bunny#graph-models) |
54 | | -from the [PyGSP](https://pygsp.readthedocs.io/en/stable/index.html) library |
55 | | -are supported. Results are provided in terms of the Mean Squared Error. |
56 | | - |
57 | | -## Graph Classification |
58 | | - |
59 | | -Run [Graph_Classification.py](https://github.com/FilippoMB/Spectral-Clustering-with-Graph-Neural-Networks-for-Graph-Pooling/blob/master/Graph_Classification.py) to train a graph classifier. Additional classification datasets are available [here](https://chrsmrrs.github.io/datasets/) (drop them in ````data/classification/````) and [here](https://github.com/FilippoMB/Benchmark_dataset_for_graph_classification) (drop them in ````data/````). |
60 | | -Results are provided in terms of classification accuracy averaged over 10 runs. |
61 | | - |
62 | | -## Citation |
63 | | - |
64 | | -Please, cite the original paper if you are using MinCutPool in your research |
65 | | - |
66 | | - @inproceedings{bianchi2020mincutpool, |
67 | | - title={Spectral Clustering with Graph Neural Networks for Graph Pooling}, |
68 | | - author={Bianchi, Filippo Maria and Grattarola, Daniele and Alippi, Cesare}, |
69 | | - booktitle={Proceedings of the 37th international conference on Machine learning}, |
70 | | - pages={2729-2738}, |
71 | | - year={2020}, |
72 | | - organization={ACM} |
73 | | - } |
74 | | - |
75 | | -## License |
76 | | - |
77 | | -The code is released under the MIT License. See the attached LICENSE file. |
| 1 | +# Spectral Clustering with Graph Neural Networks for Graph Pooling |
| 2 | + |
| 3 | +<img src="./figs/mincutpool.png" width="400" height="200"> |
| 4 | + |
| 5 | +This code reproduces the experimental results obtained with the MinCutPool layer |
| 6 | +as presented in the ICML 2020 paper |
| 7 | + |
| 8 | +[Spectral Clustering with Graph Neural Networks for Graph Pooling](https://arxiv.org/abs/1907.00481) |
| 9 | +F. M. Bianchi*, D. Grattarola*, C. Alippi |
| 10 | + |
| 11 | +The official Tensorflow implementation of the MinCutPool layer is in |
| 12 | +[Spektral](https://graphneural.network/layers/pooling/#mincutpool). |
| 13 | + |
| 14 | +The PyTorch implementation of MinCutPool is in |
| 15 | +[Pytorch Geometric](https://pytorch-geometric.readthedocs.io/en/latest/modules/nn.html#torch_geometric.nn.dense.mincut_pool.dense_mincut_pool). |
| 16 | + |
| 17 | +## Setup |
| 18 | + |
| 19 | +The code is based on Python 3.5, TensorFlow 1.15, and Spektral 0.1.2. |
| 20 | +All required libraries are listed in `requirements.txt` and can be installed with |
| 21 | + |
| 22 | +```bash |
| 23 | +pip install -r requirements.txt |
| 24 | +``` |
| 25 | + |
| 26 | +## Image segmentation |
| 27 | + |
| 28 | +<img src="./figs/overseg_and_rag.png" width="700" height="150"> |
| 29 | + |
| 30 | +Run [Segmentation.py](https://github.com/FilippoMB/Spectral-Clustering-with-Graph-Neural-Networks-for-Graph-Pooling/blob/master/Segmentation.py) |
| 31 | +to perform hyper-segmentation, generate a Region Adjacency Graph from the |
| 32 | +resulting segments, and then cluster the nodes of the RAG graph with the |
| 33 | +MinCutPool layer. |
| 34 | + |
| 35 | +## Clustering |
| 36 | + |
| 37 | +<img src="./figs/clustering_stats.png" width="600" height="250"> |
| 38 | + |
| 39 | +Run [Clustering.py](https://github.com/FilippoMB/Spectral-Clustering-with-Graph-Neural-Networks-for-Graph-Pooling/blob/master/Clustering.py) |
| 40 | +to cluster the nodes of a citation network. The datasets `cora`, `citeseer`, and |
| 41 | +`pubmed` can be selected. |
| 42 | +Results are provided in terms of homogeneity score, completeness score, and |
| 43 | +normalized mutual information (v-score). |
| 44 | + |
| 45 | +### Pytorch |
| 46 | +[Clustering_pytorch.py](https://github.com/FilippoMB/Spectral-Clustering-with-Graph-Neural-Networks-for-Graph-Pooling/blob/master/Clustering_pytorch.py) contains a basic implementation in Pytorch based on [Pytorch Geometric](https://pytorch-geometric.readthedocs.io/en/latest/modules/nn.html#torch_geometric.nn.dense.mincut_pool.dense_mincut_pool). |
| 47 | + |
| 48 | +## Autoencoder |
| 49 | + |
| 50 | +<img src="./figs/ae_ring.png" width="400" height="200"> |
| 51 | +<img src="./figs/ae_grid.png" width="400" height="200"> |
| 52 | + |
| 53 | +Run [Autoencoder.py](https://github.com/FilippoMB/Spectral-Clustering-with-Graph-Neural-Networks-for-Graph-Pooling/blob/master/Autoencoder.py) |
| 54 | +to train an autoencoder with bottleneck and compute the reconstructed graph. It |
| 55 | +is possible to switch between the `ring` and `grid` graphs, but also any other |
| 56 | +[point clouds](https://pygsp.readthedocs.io/en/stable/reference/graphs.html?highlight=bunny#graph-models) |
| 57 | +from the [PyGSP](https://pygsp.readthedocs.io/en/stable/index.html) library |
| 58 | +are supported. Results are provided in terms of the Mean Squared Error. |
| 59 | + |
| 60 | +## Graph Classification |
| 61 | + |
| 62 | +Run [Graph_Classification.py](https://github.com/FilippoMB/Spectral-Clustering-with-Graph-Neural-Networks-for-Graph-Pooling/blob/master/Graph_Classification.py) to train a graph classifier. Additional classification datasets are available [here](https://chrsmrrs.github.io/datasets/) (drop them in ````data/classification/````) and [here](https://github.com/FilippoMB/Benchmark_dataset_for_graph_classification) (drop them in ````data/````). |
| 63 | +Results are provided in terms of classification accuracy averaged over 10 runs. |
| 64 | + |
| 65 | +### Pytorch |
| 66 | +A basic Pytorch implementation of the graph classification task can be found in this [example](https://github.com/pyg-team/pytorch_geometric/blob/a238110ff5ac772656c967f135fa138add6dabb4/examples/proteins_mincut_pool.py) from Pytorch Geometric. |
| 67 | + |
| 68 | +## Citation |
| 69 | + |
| 70 | +Please, cite the original paper if you are using MinCutPool in your research |
| 71 | + |
| 72 | + @inproceedings{bianchi2020mincutpool, |
| 73 | + title={Spectral Clustering with Graph Neural Networks for Graph Pooling}, |
| 74 | + author={Bianchi, Filippo Maria and Grattarola, Daniele and Alippi, Cesare}, |
| 75 | + booktitle={Proceedings of the 37th international conference on Machine learning}, |
| 76 | + pages={2729-2738}, |
| 77 | + year={2020}, |
| 78 | + organization={ACM} |
| 79 | + } |
| 80 | + |
| 81 | +## License |
| 82 | + |
| 83 | +The code is released under the MIT License. See the attached LICENSE file. |
0 commit comments