Reference Example

Consider the following blog file which models the example given on page 3 in the tech report. We assume at least four instances of Person and Disease, respectively.

type Disease;
guaranteed Disease d[4];
type Person;
guaranteed Person p[4];

random Boolean Epidemic(Disease);
random Boolean Sick(Disease, Person);

// phi_1
parfactor Disease D .
    MultiArrayPotential[[0.1, 0.9]]

// phi_2
parfactor Disease D, Person P .
    MultiArrayPotential[[0.3, 0.1, 0.3, 0.2]]
    (Epidemic(D), Sick(D,P));

// some evidence
obs(Sick(d1, p1)) = true;
obs(Sick(d1, p2)) = true;
obs(Sick(d1, p3)) = true;
obs(Sick(d2, p1)) = true;
obs(Sick(d2, p2)) = true;

// queries
query Epidemic(d1);
query Epidemic(d2);
query Epidemic(d3);
query Sick(d3, p1);

The given model has observations for parameterised random variables with two logical variables. Only one variable will be handled lifted by the lifted absorption operator implemented by Taghipour.

Example Output

The result (parsing and jtree construction omitted) is the distribution for the query variables, followed by additional information about the inference procedure.

Trial 0:
======== Query Results =========
Distribution of values for Epidemic(d1)
    0.9183673469387755    false
    0.0816326530612245    true

Distribution of values for Epidemic(d2)
    0.9336099585062241    false
    0.06639004149377595    true

Distribution of values for Epidemic(d3)
    0.9564699880972624    false
    0.04353001190273764    true

Distribution of values for Sick(d3, p1)
    0.6065295017854107    true
    0.3934704982145894    false

Additional Information

During execution, some helpful statistics are printed out.

engine    fojt.LiftedJTEngine
name    website-example
|G|    2
|gr|    20
|Q|    4
|E|    5
size    1
width    2

The first part gives information about the inference procedure and the model, where

  • |G| is the number of (par)factors in the model
  • |gr| the number of factors in G grounded
  • |Q| the number of queries
  • |E| the number of observations introduced
  • size is the number of nodes in the (first-order) junction tree
  • width is the largest number of (parameterised) random variables in a node of the (FO) jtree

The example highlights how to write a model and what the output of the program means. But, the example is not a well-suited one for the lifted junction tree algorithm as the output shows that the constructed junction tree has only one node and thus query answering coincides with lifted variable elimination.

Split times
t_0    58571842 ns    58 ms
t_1    311526 ns    0 ms
t_2    12514156 ns    12 ms
t_3    6134797 ns    6 ms
t_4    4896715 ns    4 ms
t_5    5695728 ns    5 ms
t_6    4810088 ns    4 ms
t_total    109216890 ns    109 ms

The second part prints the time required for

  • t_0 tree construction
  • t_1 entering evidence
  • t_2 message passing in the tree
  • t_3 to t_k time for individual queries (up to k-2)
  • t_total overall running time

mem    1627368 B    1589 kB

This line lists the required memory as given by Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()

VE ops    tot=SO,CC,CE,Pr,Ab,Sp
VE ops    51=25,0,0,0,10,16

The variable elimination operations are counted, given by

  • tot = total number of VE operations
  • SO = splitting operations
  • CC = counting conversions
  • CE = counting expansion
  • Pr = Propositionalization
  • Ab = Absorption
  • Sp = Splitting