Code Monkey home page Code Monkey logo

hgcae's Introduction

Hyperbolic Graph Convolutional Auto-Encoders

Accepted to CVPR2021 🎉

Official PyTorch code of Unsupervised Hyperbolic Representation Learning via Message Passing Auto-Encoders

Jiwoong Park*, Junho Cho*, Hyung Jin Chang, Jin Young Choi (* indicates equal contribution)

vis_cora Embeddings of cora dataset. GAE is Graph Auto-Encoders in Euclidean space, HGCAE is our method. P is Poincare ball, H is Hyperboloid.

Overview

This repository provides HGCAE code in PyTorch for reproducibility with

  • PoincareBall manifold
  • Link prediction task and node clustering task on graph data
    • 6 datasets: Cora, Citeseer, Wiki, Pubmed, Blog Catalog, Amazon Photo
    • Amazon Photo was downloaded via torch-geometric package.
  • Image clustering task on images
    • 2 datasets: ImageNet10, ImageNetDog
    • Image features extracted from ImageNet10, ImageNetDog with PICA image clustering algorithm
    • Mutual K-NN graph from the image features provided.
  • ImageNet-BNCR
    • We have constructed a new dataset, ImageNet-BNCR(Balanced Number of Classes across Roots), via randomly choosing 3 leaf classes per root. We chose three roots, Artifacts, Natural objects, and Animal. Thus, there exist 9 leaf classes, and each leaf class contains 1,300 images in ImageNet-BNCR dataset.
    • bncr

Installation Guide

We use docker to reproduce performance. Please refer guide.md

Usage

1. Run docker

Before training, run our docker image:

docker run --gpus all -it --rm --shm-size 100G -v $PWD:/workspace junhocho/hyperbolicgraphnn:8 bash

If you want to cache edge splits for train/val dataset and load faster afterwards, mkdir ~/tmp and run:

docker run --gpus all -it --rm --shm-size 100G -v $PWD:/workspace -v ~/tmp:/root/tmp junhocho/hyperbolicgraphnn:8 bash

2. train_<dataset>.sh

In the docker session, run each train shell script for each dataset to reproduce performance:

Graph data link prediction

Run following commands to reproduce results:

  • sh script/train_cora_lp.sh
  • sh script/train_citeseer_lp.sh
  • sh script/train_wiki_lp.sh
  • sh script/train_pubmed_lp.sh
  • sh script/train_blogcatalog_lp.sh
  • sh script/train_amazonphoto_lp.sh
ROC AP
Cora 0.94890703 0.94726805
Citeseer 0.96059407 0.96305937
Wiki 0.95510805 0.96200790
Pubmed 0.96207212 0.96083080
Blog Catalog 0.89683939 0.88651569
Amazon Photo 0.98240673 0.97655753

Graph data node clustering

  • sh script/train_cora_nc.sh
  • sh script/train_citeseer_nc.sh
  • sh script/train_wiki_nc.sh
  • sh script/train_pubmed_nc.sh
  • sh script/train_blogcatalog_nc.sh
  • sh script/train_amazonphoto_nc.sh
ACC NMI ARI
Cora 0.74667651 0.57252940 0.55212928
Citeseer 0.69311692 0.42249294 0.44101404
Wiki 0.45945946 0.46777881 0.21517031
Pubmed 0.74849115 0.37759262 0.40770875
Blog Catalog 0.55061586 0.32557388 0.25227964
Amazon Photo 0.78130719 0.69623651 0.60342107

Image clustering

  • sh script/train_ImageNet10.sh
  • sh script/train_ImageNetDog.sh
ACC NMI ARI
ImageNet10 0.85592308 0.79019131 0.74181220
ImageNetDog 0.38738462 0.36059650 0.22696503
  • At least 11GB VRAM is required to run on Pubmed, BlogCatalog, Amazon Photo.
  • We have used GTX 1080ti only in our experiments.
  • Other gpu architectures may not reproduce above performance.

Parameter description

  • dataset : Choose dataset. Refer to each training scripts.
  • c : Curvature of hypebolic space. Should be >0. Preferably choose from 0.1, 0.5 ,1 ,2.
  • c_trainable : 0 or 1. Train c if 1.
  • dropout : Dropout ratio.
  • weight_decay : Weight decay.
  • hidden_dim : Hidden layer dimension. Same dimension used in encoder and decoder.
  • dim : Embedding dimension.
  • lambda_rec : Input reconstruction loss weight.
  • act : relu, elu, tanh.
  • --manifold PoincareBall : Use Euclidean if training euclidean models.
  • --node-cluster 1 : If specified perform node clustering task. If not, link prediction task.

Acknowledgments

This repo is inspired by hgcn.

And some of the code was forked from the following repositories:

License

This work is licensed under the MIT License

Citation

@inproceedings{park2021unsupervised,
  title={Unsupervised Hyperbolic Representation Learning via Message Passing Auto-Encoders},
  author={Jiwoong Park and Junho Cho and Hyung Jin Chang and Jin Young Choi},
  booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition},
  year={2021}
}

hgcae's People

Contributors

junhocho avatar

Stargazers

AbbynamesSheep avatar Hawking Lai avatar  avatar  avatar  avatar Junha Park avatar Rohan Banerjee avatar Mauricio A. Diaz avatar Elma avatar Clément Bonet avatar Darius Petermann avatar  avatar  avatar  avatar Hansheng XUE avatar  avatar Qingmei Tang avatar  avatar WangZhen avatar Norio Kosaka avatar Wonjun Hong avatar ebigram avatar Chiantine P. Manigos avatar Joshua Levy avatar Jinyeong chae avatar  avatar Chenyang Yu avatar 爱可可-爱生活 avatar Wei Peng avatar WPZ avatar  avatar Rafael H Tibães avatar  avatar Hoyoon Byun avatar Sanghyuk Chun avatar Sangdoo Yun avatar  avatar  avatar  avatar  avatar  avatar bhheo avatar jwpark avatar

Watchers

James Cloos avatar  avatar jwpark avatar

hgcae's Issues

Question about poincare distance

Hi,
In the manifolds.poincare.py, the square distance is defined as (line 26-32):

`

sqrt_c = c ** 0.5
dist_c = artanh(
    sqrt_c * self.mobius_add(-p1, p2, c, dim=-1).norm(dim=-1, p=2, keepdim=False)
)
dist = dist_c * 2 / sqrt_c
return dist ** 2

`

But according to the equation (2) in the paper, the square distance in Poincare ball should be like this
`

sqrt_c = c ** 0.5
sq_norms_p1 = torch.sum(p1**2, dim=-1)
sq_norms_p2 = torch.sum(p2**2, dim=-1)
sq_d = torch.sum((p1-yp2)**2, dim=-1)
dist_c = arcosh(
    1 + 2*c*sq_d/(1+c*sq_norms_p1)/1+c*sq_norms_p2)
)
dist = dist_c / sqrt_c
return dist ** 2

`

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.