Giter VIP home page Giter VIP logo

sacn's Introduction

SACN

Paper: "End-to-end Structure-Aware Convolutional Networks for Knowledge Base Completion"

Published in the Thirty-Third AAAI Conference on Artificial Intelligence (AAAI-19).

--- PyTorch Version ---

Overview

The end-to-end Structure-Aware Convolutional Network (SACN) model takes the benefit of GCN and ConvE together for knowledge base completion. SACN consists of an encoder of a weighted graph convolutional network (WGCN), and a decoder of a convolutional network called Conv-TransE. WGCN utilizes knowledge graph node structure, node attributes and edge relation types. The decoder Conv-TransE enables the state-of-the-art ConvE to be translational between entities and relations while keeps the same link prediction performance as ConvE.

Installation

This repo supports Linux and Python installation via Anaconda.

  1. Install PyTorch 1.0 using official website or Anaconda.

  2. Install the requirements: pip install -r requirements.txt

  3. Download the default English model used by spaCy, which is installed in the previous step python -m spacy download en.

Data Preprocessing

Run the preprocessing script for FB15k-237, WN18RR, FB15k-237-attr and kinship: sh preprocess.sh.

Run a model

To run a model, you first need to preprocess the data. This can be done by specifying the process parameter.

For ConvTransE model, you can run it using:

CUDA_VISIBLE_DEVICES=0 python main.py model ConvTransE init_emb_size 100 dropout_rate 0.4 channels 50 lr 0.001 kernel_size 3 dataset FB15k-237 process True

For SACN model, you can run it using:

CUDA_VISIBLE_DEVICES=0 python main.py model SACN dataset FB15k-237 process True

You can modify the hyper-parameters from "src.spodernet.spodernet.utils.global_config.py" or specify the hyper-parameters in the command. For different datasets, you need to tune the parameters.

For this test version, if you find any problems, please feel free and email me. We will keep updating the code.

Acknowledgements

Code is inspired by ConvE.

sacn's People

Contributors

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