Equation Conditionals

Suppose continuous node X has the parents Y and B.  If you wanted to give P(X|Y) a different equation involving X and Y for different values of B, you could write something like.

p(X|Y,B) =

(B < 2) ? NormalDist (X, 3 + Y, 1) :

(B < 6) ? NormalDist (X, 2 + Y, 3) :

UniformDist (X, 0, 10)

The conditions are evaluated in order, so the first covers all cases where B < 2, the second covers cases 2 £ B < 6, and the last covers the remaining cases (i.e. B ³ 6).  So, if B is less than 2, X is distributed normally with mean 3+Y, if it is between 2 and 6 then the mean is 2+Y, and if it is over 6 then X is distributed uniformly.

If there are more parents, this sort of construct can be nested to provide a tree structure of possible contingencies.

Here are a couple more examples.  They show a way to condition over the states of a discrete node:

p(X|Y,B) =

(B == yellow) ? NormalDist (X, 2, sqrt (Y)) :

(B == orange) ? NormalDist (X, 4, Y) :

(B == red) ? NormalDist (X, 6, Y ^ 2) : 0

 

p(X|B) =

member (B, CA, TX, FL) ? NormalDist (X, 3, 1) :

member (B, MA, WA) ? NormalDist (X, 5, 1) :

member (B, NY, UT, VA) ? NormalDist (X, 7, 2) :

UniformDist (X, 0, 10)

Notice that the “fall through” case of the first example is simply a 0.  This indicates that the designer is counting on B to be one of yellow, orange or red.  If B ever has another state, then when Netica is converting the equation to a table it will give a warning message that “for n/N conditions, no nonzero probability was discovered by sampling” (providing no sampling uncertainty is being added).

In the last example, the fall through case gives a uniform distribution.  If extra states are later added to B, then they will just fall through and use the uniform distribution.