public static double[] mbDistribution(Node Xi,
Map<RandomVariable, Object> evt)
{
FiniteDomain fd = (FiniteDomain) Xi.getRandomVariable().getDomain();
double[] X = new double[fd.size()];
for (int i = 0; i < fd.size(); i++)
{
// P(x'<sub>i</sub>|mb(Xi)) =
// αP(x'<sub>i</sub>|parents(X<sub>i</sub>)) *
// ∏<sub>Y<sub>j</sub> ∈ Children(X<sub>i</sub>)</sub>
// P(y<sub>j</sub>|parents(Y<sub>j</sub>))
double cprob = 1.0;
foreach (Node Yj in Xi.getChildren())
{
cprob *= Yj.getCPD().getValue(
getEventValuesForXiGivenParents(Yj, evt));
}
X[i] = Xi.getCPD()
.getValue(
getEventValuesForXiGivenParents(Xi,
fd.getValueAt(i), evt))
*cprob;
}
return Util.normalize(X);
}