Inference in Probabilistic Logic Programs with Continuous Random Variables

Muhammad Asiful Islam, C.R. Ramakrishnan, I. V. Ramakrishnan


Paper:

The paper is available at CoRR, http://arxiv.org/abs/1112.2681. In addition to the technical details, it contains an appendix which presents the proof of proposition 1.

Prototype:

We implemented the inference algorithm presented in the paper in the XSB logic programming system. This proof-of-concept prototype is implemented as a meta-interpreter and currently supports discrete and Gaussian distributions. The meaning of various probabilistic predicates (e.g., msw, values, set_sw) in the system are similar to that of PRISM system. This implementation illustrates how the inference algorithm specializes to the specialized techniques that have been developed for several popular statistical models such as HMM, FMM, Hybrid Bayesian Networks and Kalman Filters.

Download: https://www.cs.stonybrook.edu/~cram/constdist/code.tar

The package contains the following three files:

Example: Consider a factory with two machines a and b. Each machine produces a widget structure from a specific normal distribution and color of a widget is generated from an independent normal distribution. In the following program, msw(m, M) chooses either machine a or b, msw(w(M), Z) gives a product structure Z, msw(pt, Y) gives a color Y, and finally X = Y + Z returns a painted widget X.

% import {} for constraints.
:- import {}/1 from clpr.

% declare clauses as dynamic.
:- dynamic widget/1, msw/2.

% FMM with linear constraint. Widget code. (Example 2) 
widget(X) :-
	msw(m, M),
	msw(w(M), Z),
	msw(pt, Y),
	{X = Y + Z} .

% Define msw relations, their values and distributions.
msw(m, _).
values(m, [a, b]).
set_sw(m, [0.3, 0.7]).

msw(w(_), _). 
values(w(_), real).
set_sw(w(a), norm(2, 1)).
set_sw(w(b), norm(3, 1)).

msw(pt, _). 
values(pt, real).
set_sw(pt, norm(0.5, 0.1)).
Here, at the beginning 'import {}/1 from clpr' is needed for writing constraints. Since this is a meta-interpreter, make sure to declare your claueses 'dynamic' at the beginning of your code.

In the above program, we defined three random processes namely m, w and pt; and their associated values and distributions. Note that we also used a constraint { X = Y + Z } to define that random variable X is a linear combination of Y and Z.

For illustration purposes, we included a sample program file called prog.P. It includes code for mixture models, hidden markov models and kalman filters. Now that you've written a probabilistic program, execute the following commands in XSB command prompt to run your program.

Note that like PRISM, prob(G) returns the probability of G. For programs with continuous random variables, it returns the distribution of the random variables in the goal predicate. For example, prob(kf(1, T)) gives the filtered distribution of state T after observing one symbol. In general, prob(G) returns the success function of the goal G. Please see the paper for definition and general form of success functions. To illustrate the success functions of some goals, let's consider the following examples.

Note that for continuous random variables, prob/1 returns a distribution, not any specific probability. Probability can be computed over an interval by integrating the success function on that interval/range.

Questions?

Send an email to: