Skip to content

azreasoners/NeurASP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NeurASP

This is the implementation of NeurASP: Embracing Neural Networks into Answer Set Programming.
Lab page

Introduction

NeurASP is a simple extension of answer set programs by embracing neural networks. By treating the neural network output as the probability distribution over atomic facts in answer set programs, NeurASP provides a simple and effective way to integrate sub-symbolic and symbolic computation. This repository includes examples to show

  1. how NeurASP can make use of pretrained neural networks in symbolic computation and how it can improve the perception accuracy of a neural network by applying symbolic reasoning in answer set programming; and
  2. how NeurASP is used to train a neural network better by training with rules so that a neural network not only learns from implicit correlations from the data but also from the explicit complex semantic constraints expressed by ASP rules.

Installation

  1. We assume Anaconda is installed. One can install it according to its installation page.
  2. Clone this repo:
git clone https://github.com/azreasoners/NeurASP
cd NeurASP
  1. Create a virtual environment neurasp. Install clingo (ASP solver) and tqdm (progress meter).
conda create --name neurasp python=3.9
conda activate neurasp
conda install -c potassco clingo=5.5 tqdm
  1. Install Pytorch according to its Get-Started page. Below is an example command we used on Linux with cuda 10.2. (PyTorch version 1.12.0 is tested.)
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch

Examples

We provide 3 inference and 5+4 learning examples as shown below. Each example is stored in a separate folder with a readme file.

Inference Examples

Learning Examples

Related Work

You may also be interested in our work Injecting Logical Constraints into Neural Networks via Straight-Through-Estimators. Its codes are available here.

Citation

Please cite our paper as:

@inproceedings{ijcai2020p243,
  title     = {NeurASP: Embracing Neural Networks into Answer Set Programming},
  author    = {Yang, Zhun and Ishay, Adam and Lee, Joohyung},
  booktitle = {Proceedings of the Twenty-Ninth International Joint Conference on
               Artificial Intelligence, {IJCAI-20}},
  publisher = {International Joint Conferences on Artificial Intelligence Organization},
  editor    = {Christian Bessiere},
  pages     = {1755--1762},
  year      = {2020},
  month     = {7},
  note      = {Main track},
  doi       = {10.24963/ijcai.2020/243},
  url       = {https://doi.org/10.24963/ijcai.2020/243},
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages