All Projects → Tixierae → Graph_2d_cnn

Tixierae / Graph_2d_cnn

Code and data for the paper 'Classifying Graphs as Images with Convolutional Neural Networks' (new title: 'Graph Classification with 2D Convolutional Neural Networks')

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Graph 2d cnn

100daysofmlcode
My journey to learn and grow in the domain of Machine Learning and Artificial Intelligence by performing the #100DaysofMLCode Challenge.
Stars: ✭ 146 (+117.91%)
Mutual labels:  artificial-intelligence, classification, neural-networks
Cnn Svm
An Architecture Combining Convolutional Neural Network (CNN) and Linear Support Vector Machine (SVM) for Image Classification
Stars: ✭ 170 (+153.73%)
Mutual labels:  artificial-intelligence, classification, convolutional-neural-networks
Malware Classification
Towards Building an Intelligent Anti-Malware System: A Deep Learning Approach using Support Vector Machine for Malware Classification
Stars: ✭ 88 (+31.34%)
Mutual labels:  artificial-intelligence, classification, convolutional-neural-networks
Vectorai
Vector AI — A platform for building vector based applications. Encode, query and analyse data using vectors.
Stars: ✭ 195 (+191.04%)
Mutual labels:  artificial-intelligence, neural-networks, embeddings
Komputation
Komputation is a neural network framework for the Java Virtual Machine written in Kotlin and CUDA C.
Stars: ✭ 295 (+340.3%)
Mutual labels:  artificial-intelligence, convolutional-neural-networks, neural-networks
Sincnet
SincNet is a neural architecture for efficiently processing raw audio samples.
Stars: ✭ 764 (+1040.3%)
Mutual labels:  artificial-intelligence, convolutional-neural-networks, neural-networks
Iresnet
Improved Residual Networks (https://arxiv.org/pdf/2004.04989.pdf)
Stars: ✭ 163 (+143.28%)
Mutual labels:  artificial-intelligence, convolutional-neural-networks, neural-networks
Deep Learning With Python
Deep learning codes and projects using Python
Stars: ✭ 195 (+191.04%)
Mutual labels:  artificial-intelligence, convolutional-neural-networks, neural-networks
Transfer Learning Suite
Transfer Learning Suite in Keras. Perform transfer learning using any built-in Keras image classification model easily!
Stars: ✭ 212 (+216.42%)
Mutual labels:  artificial-intelligence, classification, convolutional-neural-networks
Artificio
Deep Learning Computer Vision Algorithms for Real-World Use
Stars: ✭ 326 (+386.57%)
Mutual labels:  artificial-intelligence, convolutional-neural-networks, neural-networks
Machine Learning From Scratch
Succinct Machine Learning algorithm implementations from scratch in Python, solving real-world problems (Notebooks and Book). Examples of Logistic Regression, Linear Regression, Decision Trees, K-means clustering, Sentiment Analysis, Recommender Systems, Neural Networks and Reinforcement Learning.
Stars: ✭ 42 (-37.31%)
Mutual labels:  artificial-intelligence, classification, neural-networks
Cgnn
Crystal Graph Neural Networks
Stars: ✭ 48 (-28.36%)
Mutual labels:  graph-theory, neural-networks
Gd Uap
Generalized Data-free Universal Adversarial Perturbations
Stars: ✭ 50 (-25.37%)
Mutual labels:  artificial-intelligence, classification
Sru Deeplearning Workshop
دوره 12 ساعته یادگیری عمیق با چارچوب Keras
Stars: ✭ 66 (-1.49%)
Mutual labels:  classification, convolutional-neural-networks
Deepbrain
Deep Learning tools for brain medical images
Stars: ✭ 51 (-23.88%)
Mutual labels:  artificial-intelligence, neural-networks
Tensorhub
TensorHub is a library built on top of TensorFlow 2.0 to provide simple, modular and repeatable abstractions to accelerate deep learning research.
Stars: ✭ 48 (-28.36%)
Mutual labels:  artificial-intelligence, neural-networks
Php Ml
PHP-ML - Machine Learning library for PHP
Stars: ✭ 7,900 (+11691.04%)
Mutual labels:  artificial-intelligence, classification
Espnetv2 Coreml
Semantic segmentation on iPhone using ESPNetv2
Stars: ✭ 66 (-1.49%)
Mutual labels:  artificial-intelligence, convolutional-neural-networks
Pycm
Multi-class confusion matrix library in Python
Stars: ✭ 1,076 (+1505.97%)
Mutual labels:  artificial-intelligence, classification
Meme Generator
MemeGen is a web application where the user gives an image as input and our tool generates a meme at one click for the user.
Stars: ✭ 57 (-14.93%)
Mutual labels:  artificial-intelligence, neural-networks

Graph classification with 2D CNNs GitHub stars GitHub forks

PWC PWC PWC PWC

What is this repo for?

This repo provides the code and datasets used in the paper Classifying graphs as images with Convolutional Neural Networks (Tixier, Nikolentzos, Meladianos and Vazirgiannis, 2017). Note that the paper was published at the ICANN 2019 conference under the title Graph classification with 2D convolutional neural networks. As its name suggests, the paper introduces a technique to perform graph classification with standard Convolutional Neural Networks for images (2D CNNs).

Idea

We encode graphs as stacks of 2D histograms of their node embeddings, and pass them to a classical 2D CNN architecture designed for images. The bins of the histograms can be viewed as pixels, and the value of a given pixel is the number of nodes falling into the associated bin.

For instance, below are the node embeddings and corresponding bivariate histograms for graph ID #10001 (577 nodes, 1320 edges) of the REDDIT-12K dataset: alt text The full image representation of a graph is given by stacking its n_channels bivariate histograms (where n_channels can be 2,5...). Each pixel is thus associated with a n_channels-dimensional vector of counts.

Results

Despite its simplicity, our method proves very competitive to state-of-the-art graph kernels, and even outperforms them by a wide margin on some datasets.

10-fold CV average test set classification accuracy of state-of-the-art graph kernel and graph CNN baselines (top), vs our 2D CNN approach (bottom): alt text

The results reported in the paper (without data augmentation) are available in the /datasets/results/ subdirectory, with slight variations due to the stochasticity of the approach. You can read them using the read_results.py script.

Advantages over graph kernels + SVM (GK+SVM)

We can summarize the advantages of our approach as follows:

  • better accuracy: CNNs learn their own features directly from the raw data during training to optimize performance on the downstream task (whereas GKs compute similarity a priori)
  • better accuracy: we compute images of graphs from their node embeddings (obtained via node2vec), so we capture both local and global information about the networks (whereas most GKs, based on substructures, capture only local information)
  • reduced time complexity at the graph level: node2vec is linear in the number of nodes (whereas most GKs are polynomial) -> we can process bigger graphs
  • reduced time complexity at the collection level: the time required to process a graph with a 2D CNN is constant (all images have same dimension for a given dataset), and the time required to go through the entire dataset with a 2D CNN grows linearly with the size of the dataset (whereas GKs take quadratic time to compute kernel matrix, then finding the support vectors is again quadratic) -> we can process bigger datasets

Use

  • get_node2vec.py computes the node2vec embeddings of the graphs from their adjacency matrices (parallelized over graphs)
  • get_histograms.py computes the image representations of the graphs (stacks of 2D histograms) from their node2vec embeddings (parallelized over graphs)
  • main.py reproduces the experiments in the paper (classification of graphs as images with a 2D CNN architecture, using a 10-fold cross validation scheme)
  • main_data_augmentation.py is like main.py, but it implements the data augmentation scheme described in the paper (smoothed bootstrap)

Command line examples and descriptions of the parameters are available within each script.

Setup

Code was developed and tested under Ubuntu 16.04.2 LTS 64-bit operating system and Python 2.7 with Keras 1.2.2 and tensorflow 1.1.0 backend.

Other notable dependencies

  • igraph 0.7.1
  • scikit-learn 0.18.1
  • numpy 1.11.0
  • multiprocessing
  • functools
  • json
  • argparse

Correspondence between names of datasets in the paper and in the code (paper -> code)

  • IMDB-B -> imdb_action_romance
  • COLLAB -> collab
  • REDDIT-B -> reddit_iama_askreddit_atheism_trollx
  • REDDIT-5K -> reddit_multi_5K
  • REDDIT-12K -> reddit_subreddit_10K

Cite

If you use some of the code in this repository in your work, please cite:

Conference version (ICANN 2019):

@inproceedings{tixier2019graph,
  title={Graph classification with 2d convolutional neural networks},
  author={Tixier, Antoine J-P and Nikolentzos, Giannis and Meladianos, Polykarpos and Vazirgiannis, Michalis},
  booktitle={International Conference on Artificial Neural Networks},
  pages={578--593},
  year={2019},
  organization={Springer}
}

Pre-print version (2017):

@article{tixier2017classifying,
  title={Classifying Graphs as Images with Convolutional Neural Networks},
  author={Tixier, Antoine Jean-Pierre and Nikolentzos, Giannis and Meladianos, Polykarpos and Vazirgiannis, Michalis},
  journal={arXiv preprint arXiv:1708.02218},
  year={2017}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].