* comprising assignments for the Markov Blanket X<sub>i</sub>.
* @return a random sample from <b>P</b>(X<sub>i</sub> | mb(X<sub>i</sub>))
*/
public static double[] mbDistribution(Node Xi,
Map<RandomVariable, Object> event) {
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;
for (Node Yj : Xi.getChildren()) {
cprob *= Yj.getCPD().getValue(
getEventValuesForXiGivenParents(Yj, event));
}
X[i] = Xi.getCPD()
.getValue(
getEventValuesForXiGivenParents(Xi,
fd.getValueAt(i), event))
* cprob;
}
return Util.normalize(X);
}