Probabilistic Logic Programming

What is a good resource for Probabilistic Logic Programming in Prolog, SWI-Prolog in particular?

I found ProbLog which looks elegant but seems to be implemented on top of Python instead of one of the Prolog flavors.

3 Likes

I’d suggest to start with a look at the terrific site http://cplint.ml.unife.it/

6 Likes

You can also check out the book http://ml.unife.it/plp-book/ which is associated with the site mentioned by Jan

2 Likes

http://mcs.unife.it/~friguzzi/plptutorial/#tutorial is very nice and easy also.

1 Like

BTW, what is the speed slowdown expected by using cplint with a simple lpad (comparing it with calling a regular non-probabilistic predicate)?

Probabilistic reasoning is in general very expensive so a slowdown with respect to plain prolog is to be expected. What is the program you are trying?

I was simply experimenting with different examples from your book, so I was wondering if you had made a benchmark to measure the slowdown.

I have made no such benchmarks because it would not be very fair: plain prolog and probabilistic prolog compute different things. In fact, I don’t know of anybody that has done this comparison.
However, if you want to get an idea of the difference, you can try the computation of the existence of a path in a grah, see

http://cplint.eu/example/inference/path_tabling.swinb

for the probabilistic version.

If you consider the attached graph, cplint takes more than 1 hour to answer the query prob(path(1,100),P). If you remove the probabilities it takes about 10 ms to answer path(1,100)

(Attachment graph_01.pl is missing)

1 Like

Sorry, the attachment didn’t go through, here it is
https://drive.google.com/file/d/1x8a-wTG8jIIZRFM9F5QClZatYVySrOHe/view?usp=sharing

@friguzzi, I ran into an error trying to use cplint with SWI 8.1.4 on MacOS.
Install went without issues but library(pita) has issues.

?- pack_install(cplint).
Install cplint@4.5.0 from GIT at https://github.com/friguzzi/cplint.git Y/n? 
Warning: Package depends on the following:
Warning:   "auc", provided by auc@1.0 from https://github.com/friguzzi/auc.git
Warning:   "bddem", provided by bddem@4.3.1 from https://github.com/friguzzi/bddem.git
Warning:   "matrix", provided by matrix@1.9.1 from https://github.com/friguzzi/matrix.git

What do you wish to do
   (1) * Install proposed dependencies
   (2)   Only install requested package
   (3)   Cancel

Your choice? i auc@1.0      - Library for computing Areas Under the Receiving Operating Charactersitics and Precision Recall curves
i bddem@4.3.1               - A library for manipulating Binary Decision Diagrams
i matrix@1.0                - Operations with matrices
Package:                cplint
Title:                  A suite of programs for reasoning with probabilistic logic programs
Installed version:      4.5.0
Author:                 Fabrizio Riguzzi <fabrizio.riguzzi@unife.it>
Download URL:           https://github.com/friguzzi/cplint/releases/*.zip
Requires:               bddem, auc, matrix
Activate pack "cplint" Y/n? 
true.

?- use_module(library(pita)).
ERROR: /lib/swipl/pack/bddem/prolog/bddem.pl:33:
	/lib/swipl/pack/bddem/prolog/bddem.pl:33: Initialization goal raised exception:
	dlopen(/lib/swipl/pack/bddem/lib/x86_64-darwin/bddem.so, 1): Library not loaded: @rpath/libswipl.7.dylib
  Referenced from: /lib/swipl/pack/bddem/lib/x86_64-darwin/bddem.so
  Reason: image not found

Any advice?
Thank you!

Try with
pack_rebuild(bddem).

Yeah, rebuild helped. Thanks!

Dear Ielbert,

In addition to the resource/system pointed to you already, there are a number of
packages with a PLP flavour, depending if you are interested in reasoning,
parameter estimation or general machine learning.

pha- Probabilistic Horn Abduction
phil- Learning Hierarchical Probabilistic Logic Programs parameters with gradient
descent and Expectation Maximization
prism- Run PRISM as a child process
[Unfortunately this is just a harness to run Prism system. Pity it was named
Prism as it would be great to have Prism in SWI-Prolog.]
bims- Bayesian inference of model structure.
pepl- Parameter estimation for SLP with the Failure Adjusted Maximisation
pfd_meta- Probabilistic finite domains meta-interpreter

There is also a workshop on PLP, you might be interested to some of the
papers there:
http://stoics.org.uk/plp

Nicos Angelopoulos

2 Likes

@nicos, thanks for the pointers! Very relevant to my use-case.