GithubHelp home page GithubHelp logo

shawn-dm / cvpr2022-orphicx Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wanyugroup/cvpr2022-orphicx

0.0 0.0 0.0 1.99 MB

Official code for the CVPR 2022 (oral) paper "OrphicX: A Causality-Inspired Latent Variable Model for Interpreting Graph Neural Networks."

License: MIT License

Shell 0.22% Python 75.61% Jupyter Notebook 24.17%

cvpr2022-orphicx's Introduction

OrphicX

This repo covers the implementation for our paper OrphicX.

Wanyu Lin, Hao Lan, Hao Wang and Baochun Li. "OrphicX: A Causality-Inspired Latent Variable Model for Interpreting Graph Neural Networks," in the Proceedings of IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR 2022), Oral Presentation, New Orleans, Louisiana, June 19-24, 2022.

Prepare Python environment

conda create -n orphicx python=3.8.8
conda activate orphicx
conda install pytorch cudatoolkit=10.2 -c pytorch
conda install opencv scikit-learn networkx pandas tqdm matplotlib seaborn
pip install tensorboardx
pip install torch-scatter     -f https://pytorch-geometric.com/whl/torch-1.8.0+cu102.html
pip install torch-sparse      -f https://pytorch-geometric.com/whl/torch-1.8.0+cu102.html
pip install torch-cluster     -f https://pytorch-geometric.com/whl/torch-1.8.0+cu102.html
pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-1.8.0+cu102.html
pip install torch-geometric

Extract dataset and checkpoint from zip file

unzip ckpt.zip

Run experiments with checkpoints

python orphicx_node.py --gpu --dataset syn1 --plot_info_flow
python orphicx_node.py --gpu --dataset syn4 --plot_info_flow
python orphicx_graph.py --gpu --dataset Mutagenicity --plot_info_flow
python orphicx_graph.py --gpu --dataset NCI1 --plot_info_flow

Calcualte information flow is slow on CPU. If you don't have a GPU, please run following commands:

python orphicx_node.py --dataset syn1
python orphicx_node.py --dataset syn4
python orphicx_graph.py --dataset Mutagenicity
python orphicx_graph.py --dataset NCI1

Retrain OrphicX from scratch

python orphicx_node.py --gpu --dataset syn1 --output syn1_retrain --retrain
python orphicx_node.py --gpu --dataset syn4 --output syn4_retrain --retrain
python orphicx_graph.py --gpu --dataset Mutagenicity --output mutag_retrain --retrain
python orphicx_graph.py --gpu --dataset NCI1 --output nci1_retrain --retrain

cvpr2022-orphicx's People

Contributors

wanyu-lin 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.