Download


DeepProbLog

Installation

DeepProbLog can easily be installed using the following command: Make sure the required packages are installed:

pip install deepproblog

Test

To make sure your installation works, install pytest

pip install pytest

and run

python -m deepproblog test

Requirements

DeepProbLog has the following requirements:

Approximate Inference

To use Approximate Inference, we have the followign additional requirements

pip install git+https://github.com/ML-KULeuven/pyswip

The latter can be installed on Ubuntu with the following commands:

sudo apt-add-repository ppa:swi-prolog/stable
sudo apt install swi-prolog=8.4* swi-prolog-nox=8.4* swi-prolog-x=8.4*

DeepStochLog

Installation

DeepStochLog requires SWI Prolog to run. Run the following commands to install:

sudo apt-add-repository ppa:swi-prolog/stable
sudo apt-get update
sudo apt-get install swi-prolog

To install DeepStochLog itself, run the following command:

pip install deepstochlog

Requirements

DeepStochLog has the following requirements:

  • torch~=1.5.1

  • torchvision~=0.6.1

  • numpy~=1.18.1

  • pandas~=1.2.4

  • pyparsing~=2.4.7

  • dgl~=0.6.1

Running the examples

Local dependencies To see DeepStochLog in action, please first install SWI Prolog (as explained about), as well as all requirements.

Datasets The datasets used in the tasks used to evaluate DeepStochLog can be found here.

Addition example To see DeepStochLog in action, navigate to examples/addition and run addition.py in the github repo. The neural definite clause grammar specification is provided in addition.pl. The addition(N) predicate specifies/recognises that two handwritten digits N1 and N2 sum to N. The neural probability nn(number, [X], Y, digit) makes the neural network with name number (a MNIST classifier) label input image X with the digit Y.