Skip to content

Code for Injecting Logical Background Knowledge into Embeddings for Relation Extraction

License

Notifications You must be signed in to change notification settings

uclnlp/low-rank-logic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Low-rank Logic Embeddings

https://travis-ci.org/uclmr/low-rank-logic.svg?branch=master https://badges.gitter.im/Join%20Chat.svg https://badge.waffle.io/uclmr/low-rank-logic.png?label=ready&title=Ready

This repository contains code accompanying the paper: Tim Rocktäschel, Sameer Singh and Sebastian Riedel. Injecting Logical Background Knowledge into Embeddings for Relation Extraction. in: Proceedings of the Conference of the North American Chapter of the Association for Computational Linguistics – Human Language Technologies (NAACL HLT). 2015. [bib] [pdf]

./overview.png

Prerequisites

  • git to clone the repository
  • Java JDK and sbt to run code
  • gnuplot to reproduce evaluation plots
  • pdflatex to reproduce pdf tables

Download code

Clone the repository

cd ~/workspace
git clone https://github.com/uclmr/low-rank-logic.git
git submodule update --init --recursive
cd wolfe
git checkout tags/v0.4.0
cd ..

Compile and test

sbt clean compile test

Download data

NAACL13

If you have a license for the NYT corpus please write us a mail to obtain the link to the naacl2013.txt.zip file.

Move to resources
mv ~/Downloads/naacl2013.txt.zip ./src/main/resources

Comparison on Complete Data (Figure 3)

Matrix factorization

sbt 'vmargs -Xmx8G' 'run-main uclmr.MatrixFactorization ./conf/naacl2015-MF.conf'

Joint Optimization (Section 3.2)

sbt 'vmargs -Xmx8G' 'run-main uclmr.MatrixFactorization ./conf/naacl2015-Joint.conf'

Zero-shot Relation Learning (Table 1)

  • MF (matrix factorization)
sbt 'vmargs -Xmx8G' 'run-main uclmr.MatrixFactorization ./conf/naacl2015-Zero-MF.conf'
  • Inf (logical inference)
sbt 'vmargs -Xmx8G' 'run-main uclmr.MatrixFactorization ./conf/naacl2015-Zero-Inf.conf'
  • Post (post-factorization inference)
sbt 'vmargs -Xmx8G' 'run-main uclmr.MatrixFactorization ./conf/naacl2015-Zero-Post.conf'
  • Pre (pre-factorization inference)
sbt 'vmargs -Xmx8G' 'run-main uclmr.MatrixFactorization ./conf/naacl2015-Zero-Pre.conf'
  • Joint (joint optimization)
sbt 'vmargs -Xmx8G' 'run-main uclmr.MatrixFactorization ./conf/naacl2015-Zero-Joint.conf'

Generating Figure

cd data/eval
tail -105 ../out/experiments.log > subsample.log
gnuplot -e 'fileName = "subsample"' eval.gpl 
open subsample-wMAP.pdf

Relations with Few Distant Labels (Figure 2)

sbt 'run-main uclmr.util.SubsampleExperiments 4'

4 is the number of threads used to run experiments in parallel.

Evaluate predictions

sbt 'run-main uclmr.io.EvaluateNAACL ./conf/eval.conf ./data/out/latest/predict.txt'

Citing

@inproceedings{rocktaschel2015injecting,
  title={{Injecting Logical Background Knowledge into Embeddings for Relation Extraction}},
  author={Rockt{\"a}schel, Tim and Singh, Sameer and Riedel, Sebastian},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics – Human Language Technologies (NAACL HLT)},
  year={2015}
}

About

Code for Injecting Logical Background Knowledge into Embeddings for Relation Extraction

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •