.BLP Language

The Balios GUI and Engine use a special-purpose language, which is inspired by (and hence similar to) Hugin Expert A/S net language for describing Bayesian networks and influence diagrams. The language allows to create complete descriptions of Bayesina Logic Porgrams, containing specifications of the structure of the program, the conditional probability and the combining rules.

Bayesian Predicates

The basic element of a Bayesian logic program is a Bayesian predicate. In ordinary Bayesian logic programs, a Bayesian predicate represents a set of random variable (logical, discrete or continuous). The following example is taken from the blood type domain.

Example
The following Bayesian predicate description is taken from blood_founder .BLP file.

 Discrete Bayesian Predicate bloodtype/1 
      { 
	domain = (a, b, ab, null) 
	combining rule = id
	bounds = (144, 345, 70, 70)
      } 

This describes a Bayesian predicate named bloodtype/1, with states "a","b","ab", and "null". The description also gives the label and position, which are used by the Balios GUI.

A Bayesian predicate description is introduced by

prefix Bayesian predicate predicate name.

The prefix of a Bayesian predicate is either logical or discrete. Continuous predicates are in the current version of Balios not supported. Logical predicates define normal logical predicates.

Example
The following Bayesian predicate description is again taken from blood_founder .BLP file.

 Logical Predicate mother/2 
      { 
	bounds = (88, 80, 70, 70)
      } 

This describes a logical predicate named mother/2.

Logical predicates have as domain yes and no and - in princple - max as combining rule. Of course, internally - as we use a Prolog engine - they are just treated as normal logical predicates. The name of the Bayesian predicate must be unique within the model. Then follows a sequence of name/value pairs of the form

name = valu;

enclosed in braces {...}. Currently, the .BLP language defines the following fields for Bayesian predicates: states, combining_rule, and bounds. All of these fields are optional; if any field is absent, a default value is supplied instead (for logical predicates, the first two must not be specified):

    * states specifies the states of the predicate. The states are indicated by a list of strings. The list must be non-empty. The strings in the list comprise the labels of the individual states; the labels need not be unique (can even be empty strings) for the node. The default value is a list of length one, containing an empty string (i.e., the node will have one state).
    * combining_ruleis a string that specified the combining rules associated with the Bayesian predicate. Currentlyis used by the Hugin GUI when displaying the nodes. The label is not used by the inference engine. The default value is the empty string.
    * bounds is a list of integers; the list must have length four. It indicates the position within the graphical display of the Bayesian logic program within Balios' GUI. The position is not used by the inference engine. The default position is at (0,0,0,0). 

The Qualitative Part of the Program

The structure (i.e., the Bayesian clauses of the underlying Bayesian logic program) is specified indirectly by introducing potential functions, i.e., the associated conditional probability distributions.

Example
This is a typical specification of a Bayesian clause:

    Potential (bloodtype(Person)|pchrom(Person),mchrom(Person)) { ... }

This specifies that the bloodtype of a Person is probabilistically influenced by pchrom(Person) and mchrom(Person). That is, there is a directed edge for each ground instance of the Bayesian clause

     bloodtype(Person)|pchrom(Person),mchrom(Person).

For instance, assuming that bloodtype(kristian), pchrom(kristian) and mchrom(kristian) are logically entailed by the underlying logical program, than the node bloodtype(kristian) has two parents: pchrom(kristian) and mchrom(kristian), i.e., there is a directed edge from pchrom(kristian) to bloodtype(kristian), and there is a directed edge from mchrom(kristian) to bloodtype(kristian).

Not all programs are permitted. Programs are supposed to be acyclic, i.e., the induced Bayesian network is acyclic, each ground atom is influences only by a finite number of other ground atoms. Furthermore, the Bayesian clauses are assumed ot be range-restricted.
Example
The following specification is not allowed because of the induced cycle:

    potential ( a | b ) { ... }
    potential ( b | a ) { ... }

The following specification is not allowed because the clause is not range-restricted:

    potential ( a(X) | b(Y) ) { ... }

No Bayesian predicate may be referenced in any potential-specification before it has been declared by a Bayesian predicate-specification.
The Quantitative Part of the Program

We also need to specify the quantitative part of the mode. This part consists of conditional probability functions for random variables and the values a utility function may assume. Thus, we distinguish between discrete probability, continuous probability and utility potentials.

All types of potentials are different in the numerical specification between the braces of the potential-specification.

Example 9
The following description is taken from the bloodtype .BLP file, and specifies the conditional probability table of the discrete Bayesian predicate bloodtype:

Potential (bloodtype(Person)|pchrom(Person),mchrom(Person)) {
	bounds = (158, 275, 40, 40)
	clauseBounds = { (142,122,70,70) (88,27,70,70) (180,28,70,70) (15,116,55,30) }
	{ 
	  0.9	0.03	0.03	0.04	
	  0.03	0.03	0.9	0.04	
	  0.9	0.04	0.03	0.03	
	  0.03	0.03	0.9	0.04	
	  0.04	0.9	0.03	0.03	
	  0.03	0.09	0.04	0.04	
	  0.9	0.03	0.03	0.04	
	  0.03	0.9	0.04	0.04	
	  0.03	0.04	0.04	0.9	
	} 
     }     

This specifies that the conditional probability distribution of the bloodtype of a person depending of her maternal and paternal chromosomal information.

As the example shows, the conditional probability distribution is specified through the fields of a potential-specification. This data has the form of a list of non-negative real numbers. The structure of the list must be a flat list with no structure at all. The "layout" of the data list is row-major.
Row-major Representation

To find a value corresponding to a specific configuration in the row-major representation of a table. For a nice description, we refer to Hugin Expert A/S net language.
Logical Part
The definition of logical predicates can be specified at the beginning of the program description, initiated by the keyword Prolog.

Example

    Prolog {
	founder(X) :- \+(father(_,X)), \+(mother(_,X)).
	father(uwe,kristian).
	father(uwe,annette).
        ...
} 

This specifies the logical knowledge base of the blood type example program.

Actually, the whole part is simply loaded into Sicstus' workspace when loading the .BLP file in Balios. Therefore, your can load all kinds of libraries etc. provided within Sicstus. Even negation can be used as the example shows.