Example 18 Suppose d ∧z is observed given the confactors of Figure 4. The first two confactors for P(E|A, B,C, D) don't involve D or Z and so are not affected by the observation. The third confactor is removed as its body is incompatible with the observation. The fourth confactor is replaced by:

$$\left({\overline{{a}}}\wedge{\overline{{c}}},{\overline{{\left[{\begin{array}{l|l}{E}&{V a l u e}\\ {t r u e}&{0.5}\\ {f a l s e}&{0.5}\end{array}}\right]}}\right)$$

The first confactor for P(B|Y, Z) is replaced by

 Let's consider the $\alpha$-function:  $\begin{array}{|c|c|}\hline B&Value\\ \hline y,&true&0.17\\ \hline false&0.83\\ \hline\end{array}$  $\alpha=\alpha=\alpha_1,\ldots,\alpha_N$. 
The first confactor for P(D|Y, Z) is removed and the second is replaced by

$$\left(t r u e,{\begin{array}{l|l}{Y}&{{\qquad\qquad{\mathrm{Value}}}}\\ {{\qquad\qquad\qquad{\mathrm{true}}}}&{{0.21}}\\ {{\qquad\qquad\qquad{\mathrm{false}}}}&{{0.41}}\end{array}}\right)$$

![0_image_0.png](0_image_0.png)

where *true* represents the empty context.

## 4.8 Extracting The Answer

Suppose we had a single query variable X. After setting the evidence variables, and eliminating the remaining variables, we end up with confactors of the form:
{X=vi}, pi and of the form
{}, ti[X]
If e is the evidence the probability of X=vi ∧ e is proportional to the product contributions of the confactors with context X=vi and the selection for the X=vi value for the table. Thus

$P(X=v_{i}\wedge e)\propto\prod p_{i}\prod t_{i}[v_{i}]$.  $\langle X=v_{i},p_{i}\rangle$
Then we have:

$$P(X{=}v_{i}|e)={\frac{P(X{=}v_{i}\wedge e)}{\sum_{v_{j}}P(X{=}v_{j}\wedge e)}}.$$

Notice that constants of proportionality of the evidence or by removing constants (confactors with no variables) cancel in the division.

If we had multiple query variables (i.e., we wanted the marginal of the posterior), then we still multiply the remaining confactors and renormalise.

## 4.9 The Abstract Contextual Variable Elimination Algorithm

The contextual variable elimination algorithm, is given in Figure 5. A more refined version that does less splitting is given in Section 5.

The elimination procedure is called once for each non-query, non-observed variable. The order in which the variables are selected is called the **elimination ordering**. This algorithm does not imply