Code Monkey home page Code Monkey logo

conve's Introduction

ConvE

Convolutional 2D Knowledge Graph Embeddings resources. Source code coming soon.

Paper: 2D Convolutional Graph Embeddings

Used in the paper, but do not use these datasets for your research: FB15k and WN18

Installation

This repo supports Linux and Python installation via Anaconda.

  1. Install PyTorch using Anaconda
  2. Install the requirements pip install -r requirements
  3. Run the preprocessing script for WN18RR, FB15k-237, and YAGO3-10: sh preprocess.sh
  4. (Optional) Install spacy English models with python -m spacy download en.
  5. You can now run the model

Running a model

This is a bit messy, but it works.

  1. Select your model and dataset in the main.py script
  2. You can pass common parameters like learning rate (lr), dropout values (input_drop, hidden_drop, feat_drop) as parameters to the script like so:
CUDA_VISIBLE_DEVICES=0 python main.py input_drop 0.2 hidden_drop 0.3 feat_drop 0.2 lr 0.003

The command above in conjunction with ConvE as a model will yield state-of-the-art results for most link prediction datasets.

For the reverse model, you can run the provided file with the name of the dataset name and a threshold probability:

python reverse_rule.py WN18RR 0.9

To run it on new datasets, either adjust the path structure in the file, or copy your dataset folder into the data folder and make sure your dataset split files have the name train.txt, valid.txt, and test.txt which contain tab separated triples of a knowledge graph.

conve's People

Contributors

timdettmers avatar

Watchers

James Cloos avatar paper2code - bot 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.