next up previous
Next: Loading and saving data Up: JavaBayes Version 0.32 Bayesian Previous: Using JavaBayes

The JavaBayes inference algorithm

 

Now, for the inference algorithm. Please skip this if you do not intend to know the gory details of JavaBayes.

Overview and terminology

The core inference engine in JavaBayes handles arbitrary Bayesian networks. Consider a set x of discrete variables with a finite number of values. A Bayesian network defines a probability distribution through the expression:

  p(x) = prodi p(xi | pa(xi)),

where pa(xi) is a set of variables, the parents of variable xi. We use the abbreviation pi for p(xi|pa(xi)); in this notation, a generic Bayesian network can be written as p(x) = prodi pi. The evidence e is a set of values for some variables in the network. Write pe() for a distribution p() with the evidence values fixed. The JavaBayes core engine performs calculation of posterior marginals, expectations, maximum a posteriori explanations and maximum a posteriori expectation for univariate utility functions. The core engine is provided as a Java package which can be adapted and used in other applications as a tool for probabilistic reasoning.

Inferences with Bayesian networks usually involve the calculation of posterior marginals for a particular set of variables, a problem which is called belief assessment or belief updating. Another standard problem is the calculation of expectations for a utility function u(x):

Ep[u|e] = sumx not in e ue(x) p(x|e),

where p(x|e) indicates the joint distribution conditioned on the evidence. A particular case is u(x) = xq, in which case the posterior expectation for u(x) is the posterior expected value for the queried variable xq.

Maximization of probabilities and expectations are respectively called the maximum a posteriori hypothesis problem (called MAP) and the maximum expected utility problem (called MEU) MAP and MEU problems seek to obtain:

  maxd [ sumx not in d, e ( ud, e(x) prodi pd,ei ) ]

for some function u(x); the set of variables d is the set of decision variables. The objective is to find values for the decision variables so that we maximize the expectation of u(x).

The MAP problem is obtained when u(x) = 1:

  maxd [ sumx not in d, e ( prodi pd, ei ) ].

A particular case of the MAP problem which has received great attention in the literature is the most probable explanation problem (called MPE), where all variables are decision variables. The MPE solution is the configuration of variables that has highest posterior probability.

Gory details

JavaBayes is centered upon a general algorithm for probabilistic inference, variously called bucket elimination [2] or variable elimination [7]. All the standard problems mentioned above are solved through a generalized version of bucket elimination.

The algorithms are derived for the general case where a set of variables x is under consideration, where x is actually a subset of the full set of variables. It is assumed that x does not overlap with the evidence. When marginals or expectations involve a single variable xq, we can take x = xq without any modifications in the algorithms.

The basic algorithm in JavaBayes is adapted from Zhang and Poole [7], but is extended to handle maximizations and expectations in the uniform manner suggested by Dechter [2].

Three preliminary steps are necessary. The first step is to incorporate the evidence e into the network. Every probability distribution and utility function is restricted to a domain that contains no evidence. For example, evidence x2 = 3 transforms a distribution p(x1, x2, x3) into pe(x1, x3) = p(x1, x2 = 3, x3).

Second, select an ordering for the set x, equal to x1, ... , xn Call yi the ith variable in this ordering. Two types of restrictions must be respected by this ordering. If the objective is to solve a MAP or MEU problem, then the decision variables must come last. If not, then the variables in x must come last.

Third, construct a set of functions F containing all probability distributions in the network. If a utility function u(x) is specified, then include u(x) into F.

The idea of the algorithm is to multiply the members of F in the sequence given by the ordering. In doing so we construct the expression for the Bayesian network; the key fact about the algorithm is that it attempts to eliminate variables as soon as possible so that the resulting products are always manageable. Variables are eliminated by summation or maximization depending on the problem.

For all yi such that yi is not in x or e, repeat the following.

  1. Construct a list Bi of all functions in F containing yi. These functions are removed from F. This list Bi is called a bucket. The variable yi is called the bucket variable for bucket Bi.
  2. Multiply all distributions in the bucket and obtain a joint function bi(yi, Yi). This function depends on yi and some other variables which are indicated by Yi.
  3. Either sum out or maximize out yi from bi(yi, Yi). The result is a function bi(Yi) which is then included into F.

To sum yi out from a function b(), evaluate bi(Yi) = sumyi bi(yi, Yi). To maximize yi out from a function bi(yi, Yi), evaluate bi(Yi) = maxyi bi(yi, Yi). When a bucket function bi(yi, Yi) is maximized, a second function ci(Yi) can be constructed which indicates the value of yi that maximizes bi(yi, Yi). The function c(Yi) is used to generate ``best'' configurations if required.

There are several cases to consider after the buckets are processed.

The variable ordering used in the algorithm is arbitrary (except for the conditions imposed above), but different orderings lead to different computational loads. A minimum deficiency heuristic search is known to produce efficient orderings in practice [5], but this is not implemented yet in JavaBayes.


next up previous
Next: Loading and saving data Up: JavaBayes Version 0.32 Bayesian Previous: Using JavaBayes

© Fabio Cozman[Send Mail?]

Sat Aug 9 21:32:23 EDT 1997