• Stars
    star
    127
  • Rank 282,790 (Top 6 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 3 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Graph Data Augmentation Library for PyTorch Geometric

grafog

Graph Data Augmentation Library for PyTorch Geometric.


What is it?

Data augmentations are heavily used in Computer Vision and Natural Language Processing to address data imbalance, data scarcity, and prevent models from overfitting. They have also proven to yield good results in both supervised and self-supervised (contrastive) settings.

grafog (portmanteau of "graph" and "augmentation") provides a set of methods to perform data augmentation on graph-structured data, especially meant for self-supervised node classification. It is built on top of torch_geometric and is easily integrable with its Data API.

Yannic Kilcher talks about it here: https://youtu.be/smUHQndcmOY?t=961


Installation

You can install the library via pip:

$ pip install grafog

You can also install the library from source:

$ git clone https://github.com/rish-16/grafog
$ cd grafog
$ pip install -e .

Dependencies

torch==1.10.2
torch_geometric==2.0.3

Usage

The library comes with the following data augmentations:

Augmentation Remarks When to use
NodeDrop(p=0.05) Randomly drops nodes with the given p before, during training
EdgeDrop(p=0.05) Randomly drops edges with the given p before, during training
Normalize() Normalizes the node or edge features before training
NodeMixUp(lamb, classes) MixUp on node features with given lambda during training
NodeFeatureMasking(p=0.15) Randomly masks node features with the given p during training
EdgeFeatureMasking(p=0.15) Randomly masks edge features with the given p during training

There are many more features to be added over time, so stay tuned!

from torch_geometric.datasets import CoraFull
import grafog.transforms as T

node_aug = T.Compose([
    T.NodeDrop(p=0.45),
    T.NodeMixUp(lamb=0.5, classes=7),
    ...
])

edge_aug = T.Compose([
    T.EdgeDrop(0=0.15),
    T.EdgeFeatureMasking()
])

data = CoraFull()
model = ...

for epoch in range(10): # begin training loop
    new_data = node_aug(data) # apply the node augmentation(s)
    new_data = edge_aug(new_data) # apply the edge augmentation(s)
    
    x, y = new_data.x, new_data.y
    ...

Remarks

This library was built as a project for a class (UIT2201) at NUS. I planned and built it over the span of 10 weeks. I thank Prof. Mikhail Filippov for his guidance, feedback, and support!

If you spot any issues, feel free to raise a PR or Issue. All meaningful contributions welcome!


License

MIT

More Repositories

1

gpt2client

✍🏻 gpt2-client: Easy-to-use TensorFlow Wrapper for GPT-2 117M, 345M, 774M, and 1.5B Transformer Models πŸ€– πŸ“
Python
367
star
2

aft-pytorch

Unofficial PyTorch implementation of Attention Free Transformer (AFT) layers by Apple Inc.
Python
226
star
3

sight

πŸ‘ Sightseer: TensorFlow library for state-of-the-art Computer Vision and Object Detection models
Python
204
star
4

Angelfire

Add custom context menus to any DOM element πŸ‘ΌπŸ» πŸ”₯ (NUSHackers OpenHack 2020 Winner)
JavaScript
102
star
5

tokenlearner-pytorch

Unofficial PyTorch implementation of TokenLearner by Google AI
Python
63
star
6

CycleGANsformer

Unpaired Image-to-Image Translation with Transformer-based GANs in PyTorch [WIP]
Python
56
star
7

involution_pytorch

Unofficial PyTorch implementation of the Involution layer from CVPR 2021
Python
45
star
8

Network-Optimisation

Neural Network Hyper-parameter Tuning with Genetic Algorithms πŸ€– 🧬
Python
34
star
9

mlp-mixer-tf

Unofficial Implementation of MLP-Mixer in TensorFlow
Python
26
star
10

rna-backbone-design

Source code for RNA-FrameFlow: SE(3) Flow Matching for 3D RNA Backbone Design
Python
25
star
11

CS3244-Tutorial-Material

All supplementary material used by me while TA-ing CS3244: Machine Learning
Python
21
star
12

Metroplex

Using Simulated Annealing, Hill Climbing, and Genetic Algorithms to recreate images using shapes πŸ€– 🧬
Python
16
star
13

nam-pytorch

Unofficial PyTorch implementation of Neural Additive Models (NAM) by Agarwal, et al.
Python
13
star
14

TransGAN-PyTorch

[WIP] PyTorch implementation of the TransGAN paper
Python
12
star
15

gpt3-pytorch

Unofficial PyTorch Implementation of OpenAI's GPT-3
Python
11
star
16

dalle2-pytorch

Unofficial PyTorch implementation of DALL-E 2 by OpenAI
Python
10
star
17

CatGAN

Generative Adversarial Network (GAN) that generates cat faces using Google's Quick, Draw! dataset πŸ€– 😺
Python
10
star
18

Audily

πŸ“‘πŸ€– Convert PDF scans to Audiobooks with a click!
Python
8
star
19

Regolith

πŸŒ— An elegant Pseudocode-like programming language built in Python
Python
7
star
20

vit-tensorflow

[WIP] TensorFlow wrapper of Vision Transformer for SOTA image classification
Python
7
star
21

Hringhorni

A Python library for Cellular Automaton simulations
Python
6
star
22

gym-maze

gym environment for randomly-generated mazes
Jupyter Notebook
5
star
23

Neural-Machine-Translation

Neural Machine Translation model to translate English to German and vice versa.
Jupyter Notebook
5
star
24

Strelitzia

Summaries of Hacker News shared links right in your inbox
Python
4
star
25

audio-tf-pytorch

[WIP] Unofficial PyTorch implementation of the "Audio Transformer" by Verma & Berger (2021)
Python
4
star
26

Reverse-Image-Search

Small-scale reverse image search
Python
4
star
27

FGSM-Attacks

TensorFlow implementation of Fast Gradient Sign Method Attack, a White Box Adversarial Attack
Python
4
star
28

cs4248-project

Code for CS4248 Group Project (AY22/23 Sem 2)
Jupyter Notebook
4
star
29

Sheet-to-Bot

Quickly build chatbots using only Google Sheets
Python
3
star
30

open-vector

A computation and visualisation library for vector operations
Python
3
star
31

NachoDB

πŸ§€ A simple sqlite-like database written in C
C
3
star
32

CommandF

Darkflow integration to CommandF
Python
3
star
33

Golang

Learning experiments with Golang
Go
3
star
34

model-boosting

Pure NumPy implementations of popular Boosting techniques
Python
3
star
35

andromeda

Chrome extension that renders LaTeX in Substack articles
JavaScript
3
star
36

HackNRoll-2021

TypeScript
3
star
37

Hybrid-Recommendation-System

A collaborative and content-based movie recommendation system created using Python.
Python
3
star
38

Quinque

Fun image manipulation experiments with Python
Python
3
star
39

Stock-Prediction

Python code to predict Google (Alphabet) stock using QUANDL datasets. Accuracy may vary between 90% to 100%.
Python
3
star
40

convnext_pytorch

Unofficial PyTorch implementation of ConvNeXt by Facebook AI Research (FAIR)
3
star
41

cs4243-project

Fast Image Vector Search Tool built in PyTorch
Jupyter Notebook
3
star
42

ChatWithPerson

Generated personas you can chat with πŸ‘ΎπŸ‘‹πŸ»
Python
3
star
43

Simulated-Annealing-Attack

Attacking Neural Networks using Stochastic Optimisation
Python
2
star
44

mlblocks-beta

Landing page for the MLBlocks beta platform
CSS
2
star
45

Network-Estimation

Mapping the internal representation of a neural network using a k-nearest neighbours model
Python
2
star
46

Back-to-C

Picking up the C syntax after 8 years
C
2
star
47

Chirp.me

Convert Twitter Threads to Blog Posts
JavaScript
2
star
48

Keras

Keras experiments playground
Python
2
star
49

Cinimax

Minimax Implementation in C
C
2
star
50

shrubtest

🌳πŸ§ͺIn-editor API testing and experimentation extension for VS Code
TypeScript
2
star
51

GraphConv-Lightning

⚑️ Graph Convolutional Network built entirely using PyTorch Lightning
Python
2
star
52

gin-attn-conv-pytorch

Unofficial implementation of Graph Isomorphism Network in Python
Python
2
star
53

gist2blog

Converting a collection of GitHub Gists into a blog
JavaScript
2
star
54

Mario-Source

Implementation of Mario using runes from Source v1
JavaScript
2
star
55

Actor-Critic-Model

TensorFlow implementation of the Actor-Critic model
Python
2
star
56

locoprop-pytorch

Unofficial PyTorch implementation of LocoProp, an enhanced BackProp alternative
Python
2
star
57

BBCS-ML-Winpetition

Datasets and resources for the BuildingBloCS 2019 Conference
2
star
58

Leetcode-Experiments

A repo where I store some basic Leetcode experiments
Python
2
star
59

Vocq-Neural-Summariser

GitHub issues summariser based on Neural Network applications
Python
2
star
60

Long-Short-Term-Memories

A podcast hosted by 2 DialoGPT Conversational Agents
Python
2
star
61

Team-Unicorn-CXA-2019

A platform for SMEs to connect with local producers and sellers in the area and keep track of their inventories and sales in a seamless manner
JavaScript
2
star
62

COVID-Viz

JavaScript
2
star
63

CS2109S-Teaching-Material

Resources used when teaching CS2109S in AY21/22 Sem 2 at NUS Computing
2
star
64

3D-Environment-Navigation

Python
2
star
65

gaia-vscode

The dark Earth VS Code theme to cybernetically enhance your programming
2
star
66

Cheery

Cheery website frontend
CSS
2
star
67

Neural-Additive-Models

TensorFlow 2.0 implementation of Neural Additive Models
Python
2
star
68

Proximal-Policy-Optimization

PPO algorithm on David Ha's Slime Volley environment
2
star
69

PCADA_Demo_1

Source code for SMU Academy PCADA Module 3: Web Scraping and Natural Language Processing
HTML
2
star
70

KL-Divergence

A few experiments with KL Divergence for different probability distributions
Python
2
star
71

SimCLR-pytorch

Unofficial PyTorch implementation of SimCLR by Google Brain
Python
2
star
72

Lightning-Transformer

Transformer and Attention Mechanism written in PyTorch Lightning ⚑️
Python
2
star
73

Minimax-Heuristic-Search-T3

Using Minimax to generate Tic Tac Toe rollouts
Python
2
star
74

Singer2Singer

[WIP] Inter-singer audio/song conversion using Deep Learning
Python
2
star
75

Sobel-Filters

A few experiments with the Solber-Feldman Operator for traditional Edge Detection
Python
2
star
76

NodeJS-MongoDB-Blog

A complete API for blog posts using a MongoDB AWS backend πŸ“‘
HTML
2
star
77

Self-driving-car

A lane detection, vehicle detection and path finding algorithm
Python
1
star
78

Coolor

Syntax highlighting Chrome Extension for code blocks in Medium articles
JavaScript
1
star
79

Stylus.js

CSS substitute fully written in JavaScript to supercharge the process of styling elements.
JavaScript
1
star
80

MLBlocks-Phase-2

Frontend for MLBlocks Phase 2
JavaScript
1
star
81

Natural-Language-Processing

NLP experiments playground
Python
1
star
82

hello-github-actions

1
star
83

Colour-Pop

A web-app to perform the "Colour Pop" effect on images
JavaScript
1
star
84

OpenAI-Problems

OpenAI Reinforcement Learning and Algorithms Playground
Jupyter Notebook
1
star
85

pytorch-perceiver

PyTorch implementation of the Perceiver model by DeepMind
Python
1
star
86

Lingua

An open-source embeddable component for code snippets with multi-lingual support
CSS
1
star
87

heimdall

Heimdall: access the power of GPT-3 straight from Siri on any apple product :D
Python
1
star
88

turismo

Lightweight PyTorch Geometric library to build graph transformers quickly [WIP]
1
star
89

pytorch-graphdl

PyTorch Implementation of popular Graph Neural Networks
Python
1
star
90

gym-navmaze

Custom gym maze environment
Python
1
star
91

H2-Computing-Practicals

Python
1
star
92

PyTorch

Jupyter Notebook
1
star
93

gnn-training-tricks

Analysing the impact of training tricks of GNN optimisation
Python
1
star
94

Neural-Suppression

Soucre code for Neural Suppression, a regularisation technique inspired by Dropout
Python
1
star
95

Opt-In-Opt-Out

What happens when you use an optimiser to optimise an optimiser?
Python
1
star
96

Python-Decision-Trees

Pure Python implementation of Decision Trees trained on the Iris Dataset
1
star
97

cs3244-project

Source code for CS3244 AY22/23 Sem 1 Group Project
1
star
98

HackerRank

HackerRank algorithms playground
Python
1
star
99

ANN-with-swapped-training-sets

Implementation of a Deep Neural Network with swapped training and tests sets. Instead of training on pixel values to predict class labels, this implementation trains on the class labels to predict pixel values for each class.
Python
1
star
100

Tumour-Analysis

A python script to predict likelihood of Malignant or Benign Tumours in a patient using 30 different features.
Python
1
star