Coder Social home page Coder Social logo

meotecarlo / rgat Goto Github PK

View Code? Open in Web Editor NEW

This project forked from babylonhealth/rgat

0.0 0.0 0.0 162 KB

A TensorFlow implementation of Relational Graph Attention Networks, paper: https://arxiv.org/abs/1904.05811

License: Apache License 2.0

Python 100.00%

rgat's Introduction

Relational Graph Attention Networks

A TensorFlow implementation of Relational Graph Attention Networks for semi-supervised node classification and graph classification tasks introduced in our paper Relational Graph Attention Networks. It is compatible with static and eager execution modes.

Contact [email protected] for comments and questions.

Installation

To install rgat, run:

$ pip install git+git://github.com/Babylonpartners/rgat.git

To allow both the CPU and GPU versions of TensorFlow, we have not listed Tensorflow as a requirement. You will need to install a version separately. The TensorFlow version must be >= 1.10.

Examples

To make it easy to jump right in, we have provided a few examples:

  • RDF: Semi-supervised node classification on AIFB and MUTAG.
  • Batch comparison: Batched graph forward pass examples using both static and eager mode.

Usage

The graphs handles are composed of:

  • An inputs dense tensor* corresponding to node features, and
  • A support sparse tensor corresponding to node connectivity.

Below is a standard pattern for using RGAT

from rgat.layers import RGAT

inputs = get_inputs()                                # Dense tensor with shape (?, Features)

support = get_support()                              # Sparse tensor with dense shape (?, ?)
support = tf.sparse_reorder(support)                 # May be neccessary, depending on construction

rgat = RGAT(units=FLAGS.units, relations=RELATIONS)  # RELATIONS is an integer indicating the number 
                                                     # of relation types in the graph

outputs = rgat(inputs=inputs, support=support)       # Dense tensor with shape (?, FLAGS.units)

Here, get_inputs and get_support are user-provided functions. For guidance on their definition, see the usage guide.

*Note, it is possible to pass a SparseTensor as the inputs to the layer call. This will result in the identity matrix for the input (but skipping the trivial matrix multiply).

Cite

Please cite our paper if you use this code in your own work:

@article{busbridge2019rgat,
title = {Relational Graph Attention Networks},
author = {Busbridge, Dan and Sherburn, Dane and Cavallo, Pietro and Hammerla, Nils Y},
year = {2019},
eprint = {arXiv:1904.05811},
url = {http://arxiv.org/abs/1904.05811}
}

rgat's People

Contributors

dbusbridge 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.