Coder Social home page Coder Social logo

enesy's Introduction

ENeSy

This repository provides the source code & data of our paper: Neural-Symbolic Entangled Framework for Complex Query Answering (NeurIPS 2022).

Requirement

torch==1.10.0
tensorboardX
numpy
tqdm

Train the model

The standard datasets used in our work can be found in the public repository of previous work BetaE[1] and can be downloaded here.

1st step

Train the embedding of entities and relations with link prediction.

python main.py --cuda --do_train --do_valid --data_path=data/DATASET -lr=0.00001 --geo=ns --tasks="1p" -kge=RotatE -pre_1p

2nd step

Train the MLP function which is used to convert symbolic vector to embedding.

python main.py --cuda --do_train --do_valid --data_path=data/DATASET -lr=0.00001 --geo=ns --tasks="1p" -kge=RotatE -newloss --checkpoint_path=CHECKPOINTPATH --warm_up_steps=STEP

3rd step(Opt)

Fine-tune the model with complex query data.

python main.py --cuda --do_train --do_valid --data_path=data/DATASET -lr=0.00001 --geo=ns --tasks="1p.2p.3p.2i.3i.ip.pi.2in.3in.inp.pin.pni.2u.up" -kge=RotatE --checkpoint_path=CHECKPOINTPATH --warm_up_steps=STEP

--geo: string, select the reasoning model, vec for GQE, box for Query2box, beta for BetaE, ns for neural-symbolic.

--tasks: string, tasks connected by dot.

-kge: string, select the neural reasoning way of projection.

Test the model

python main.py --cuda --do_test --data_path=data/DATASET -lr=0.00001 --geo=ns --tasks="1p.2p.3p.2i.3i.ip.pi.2in.3in.inp.pin.pni.2u.up" -kge=RotatE --checkpoint_path=CHECKPOINTPATH -lambdas="0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5"

-lambdas: string, lambda used for ensemble prediction for each task connected by semicolon.

Citation

If you find this code useful, please cite the following paper.

@inproceedings{
   xu2022neuralsymbolic,
   title={Neural-Symbolic Entangled Framework for Complex Query Answering},
   author={Zezhong Xu and Wen Zhang and Peng Ye and Hui Chen and Huajun Chen},
   booktitle={Advances in Neural Information Processing Systems},
   year={2022},
   url={https://arxiv.org/pdf/2209.08779}
}

[1] Beta Embeddings for Multi-Hop Logical Reasoning in Knowledge Graphs, Hongyu Ren and Jure Leskovec, NeurIPS 2020.

enesy's People

Contributors

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