Giter Club home page Giter Club logo

gckn's Introduction

Graph convolutional kernel networks

The repository implements Graph Convolutional Kernel Networks (GCKNs) described in the following paper

Dexiong Chen, Laurent Jacob, Julien Mairal. Convolutional Kernel Networks for Graph-Structured Data. In ICML, 2020.

Installation

We strongly recommend users to use miniconda to install the following packages (link to pytorch)

python=3.6
numpy
scikit-learn
pytorch=1.3.1
pandas
networkx
Cython
cyanure

All the above packages can be installed with conda install except cyanure, which can be installed with pip install cyanure-mkl.

CUDA Toolkit also needs to be downloaded with the same version as used in Pytorch. Then place it under the path $PATH_TO_CUDA and run export CUDA_HOME=$PATH_TO_CUDA.

(OPTIONAL) To perform model visualization, you also need to install the following packages

matplotlib

Finally run make.

Examples of how to use GCKN

Data preparation

Run cd dataset; bash get_data.sh to download and unzip datasets. We provide here 3 types of datasets: datasets without node attributes (IMDBBINARY, IMDBMULTI, COLLAB), datasets with discrete node attributes (MUTAG, PROTEINS, PTC, NCI1) and datasets with continuous node attributes (BZR, COX2, ENZYMES, PROTEINS_full). All the datasets can be downloaded and extracted from this site.

Training unsupervised models

First go to experiments folder by running

export PYTHONPATH=$PWD:$PYTHONPATH
cd experiments
  • GCKN-path

    To train a one-layer (GCKN-path) model, run

    python main_unsup.py --dataset MUTAG --path-size 3 --sigma 1.5 --hidden-size 32  --aggregation

    Running python main_unsup.py --help for more information about options.

  • GCKN-subtree

    To train a two-layer (GCKN-subtree) model, run

    python main_unsup.py --dataset MUTAG --path-size 3 1 --sigma 1.5 1.5 --hidden-size 32 32 --aggregation
  • GCKN with more layers

    You can train a deeper GCKN model by listing the values of parameters (path size, hidden size, sigma) at each layer. You can also use pooling operators like mean or max rather than the default sum pooling. For example

    python main_unsup.py --dataset MUTAG --path-size 3 3 3 3 1 --sigma 1.5 1.5 1.5 1.5 1.5 --hidden-size 32 32 32 32 32 --aggregation --pooling mean --global-pooling max

Training supervised models

The options for training supervised models are the same as unsupervised models with some additional parameters such as number of epochs epochs, initial learning rate lr and regularization parameter weight-decay. For instance, to train a GCKN-subtree model, run

python main_sup.py --dataset MUTAG --path-size 3 1 --sigma 1.5 1.5 --hidden-size 32 32 --aggregation --weight-decay 1e-04

Model visualization

First a supervised model has to be trained and saved

python main_sup.py --dataset Mutagenicity --path-size 4 1 --sigma 0.4 0.4 --hidden-size 32 32 --aggregation --weight-decay 1e-05 --outdir ../logs

Then the trained model can be visualized by running

python main_sup.py --dataset Mutagenicity --path-size 4 1 --sigma 0.4 0.4 --hidden-size 32 32 --aggregation --weight-decay 1e-05 --outdir ../logs --interpret --lr 0.005 --graph-idx -1 --mu 0.01

gckn's People

Contributors

claying avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.