Coder Social home page Coder Social logo

renet's Introduction

PyTorch implementation of Recurrent Event Network (RE-Net)

Paper: Recurrent Event Network for Reasoning over Temporal Knowledge Graph

ICLR Workshop on Representation Learning on Graphs and Manifolds, 2019.

Installation

Install PyTorch (>= 0.4.0) following the instuctions on the official website. Our code is written on Python3.

Train and Test

Before running, you should preprocess datasets.

python3 data/DATA_NAME/get_history.py

Then, we are ready to train and test. We first train the model.

python3 train.py -d DATA_NAME --gpu 0 --model 0 --dropout 0.5 --n-hidden 200 --lr 1e-3 --max-epochs 20 --batch-size 1024

We are ready to test!

python3 test.py -d DATA_NAME --gpu 0 --model 0 --n-hidden 200

The default hyperparameters give the best performances.

Model variants

The user must specify a --model, the variants of which are described in detail in the paper:

  • Attentive aggregator: --model 0
  • Mean aggregator: --model 1
  • GCN aggregator: --model 2

Related Work

There are related literatures: Temporal Knowledge Graph Embedding, Dynamic Graph Embedding, Knowledge Graph Embedding, Static Graph Embedding, etc. We organized the list of related work.

Datasets

There are two datasets: ICEWS18, GDELT. Each data folder has 'stat.txt', 'train.txt', 'valid.txt', 'test.txt', and 'get_history.py'.

  • 'get_history': This is for getting history for each entity.
  • 'stat.txt': First value is the number of entities, and second value is the number of relations.
  • 'train.txt', 'valid.txt', 'test.txt': First column is subject entities, second column is relations, and third column is object entities. The fourth column is time.

Baselines

We use the following public codes for baselines and hyperparameters. We validated embedding sizes among presented values.

Baselines Code Embedding size Batch size
TransE Link 100, 200 1024
DistMult Link 100, 200 1024
ComplEx Link 50, 100, 200 100
RGCN Link 200 Default
ConvE Link 200 128
Know-Evolve Link Default Default
HyTE Link 128 Default

We implemented TA-TransE, TA-DistMult, and TTransE. The user can find implementations in the 'baselines' folder.

Predictive performances

In the ICEWS18 dataset, the results with filtered metrics:

Method MRR Hits@1 Hits@3 Hits@10
RE-Net (mean) 42.38 35.80 44.99 54.90
RE-Net (Attn) 41.46 34.67 44.19 54.44
RE-Net (GCN) 41.35 34.53 44.05 54.35

In the GDELT dataset, the results with filtered metrics:

Method MRR Hits@1 Hits@3 Hits@10
RE-Net (mean) 39.15 30.84 43.07 53.48
RE-Net (Attn) 38.07 29.44 42.26 52.93
RE-Net (GCN) 37.99 30.05 41.40 52.18

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.