This class implements a method to compare two Bayesian networks (same DAG, different CPT) node by node,
and returns the sum of the 'absolute' difference value between each pair of nodes' posterior
probabilities (may be in the case that a set of hard evidences are specified first).
This class implements the 'DIPFP' algorithm from our UAI-05 paper entitled "Modifying Bayesian Networks by Probability Constraints".
For experimental purpose, we have eight(8) variations of implementation, please refer
to "DIPFPMarginalOneR.java" and "DIPFPConditionalOneR.java" for details.
Constructor - 2:
Given an initial BN file name, a set of constraints (can be either marginal or conditional), and a choice of implementation variation.
This class implements the 'D-IPFP' algorithm based on the AISTA-2004 paper,
to process only one conditional constraint with the form 'R(A|B)', 'A={C1,C2,...,Cn}', 'B={P1,P2,...,Pm}', 'A' and 'B' are disjoint.
Eight(8) variations of implementation are provided, for experimental and analytical purpose.
Conditional Constraint provided might be either: (C, C1, ..., Cn, P1, ..., Pm are variables)
(1) Local: R(C|L) and L is a non-empty subset of Pi(C);
(2) Non-Local: R(C1,C2,...,Cn|P1, P2, ..., Pm), n>=2, {C1, C2, ..., Cn} and {P1, P2, ..., Pm} are disjoint.
Variation 1:
(1) Judge whether this constraint is local or non-local;
(2) If local, updating C's CPT only, using Q_(k)(C|Pi(C)) = Q_(k-1)(C|Pi(C)) * R(C|L) / Q_(k-1)(C|L), then normalize to 1;
(3) If non-local: (n>=1, m>=1)
Getting Y={C1,C2,...,Cn,P1,P2,...,Pm}={Yj} and it's loose closure S={Pi(Yj)}\Y (j=1 to m+n),
Q_(k)(Y,S) = Q_(k-1)(Y,S) * R(A|B) / Q_(k-1)(A|B),
Getting Q_(k)(Yj|Pi(Yj)) from Q_(k)(Y,S) for each Yj in Y and updating its CPT (j=1 to m+n).
Variation 2:
(1) Judge whether this constraint is local or non-local;
(2) If local, updating C's CPT only, using Q_(k)(C|Pi(C)) = Q_(k-1)(C|Pi(C)) * R(C|L) / Q_(k-1)(C|L), then normalize to 1;
(3) If non-local: (n>=1, m>=1)
Getting Y={C1,C2,...,Cn,P1,P2,...,Pm}={Yj} and it's loose closure S={Pi(Yj)}\Y (j=1 to m+n),
Do until converge { //Q_(k)(Y,S) ~= Q_(k)'(Y,S)
Q_(k)'(Y,S) = Q_(k-1)(Y,S) * R(A|B) / Q_(k-1)(A|B),
Getting Q_(k)(Yj|Pi(Yj)) from Q_(k)'(Y,S) for each Yj in Y and updating its CPT (j=1 to m+n).
}
Variation 3:
(1) Judge whether this constraint is local or non-local;
(2) If local, updating C's CPT only, using Q_(k)(C|Pi(C)) = Q_(k-1)(C|Pi(C)) * R(C|L) / Q_(k-1)(C|L), then normalize to 1;
(3) If non-local: (n>=1, m>=1)
Getting Y={C1,C2,...,Cn,P1,P2,...,Pm}={Yj}, it's tight closure S, and a updated variable set Y', please refer to 'RetrieveTightClosure.java',
Q_(k)(Y',S) = Q_(k-1)(Y',S) * R(A|B) / Q_(k-1)(A|B),
Getting Q_(k)(Y'j|Pi(Y'j)) from Q_(k)(Y',S) for each Y'j in Y' and updating its CPT (|Y'|>=(m+n)).
Variation 4:
(1) Judge whether this constraint is local or non-local;
(2) If local, updating C's CPT only, using Q_(k)(C|Pi(C)) = Q_(k-1)(C|Pi(C)) * R(C|L) / Q_(k-1)(C|L), then normalize to 1;
(3) If non-local: (n>=1, m>=1)
Getting Y={C1,C2,...,Cn,P1,P2,...,Pm}={Yj}, it's tight closure S, and a updated variable set Y', please refer to 'RetrieveTightClosure.java',
Do until converge { //Q_(k)(Y',S) ~= Q_(k)'(Y',S)
Q_(k)'(Y',S) = Q_(k-1)(Y',S) * R(A|B) / Q_(k-1)(A|B),
Getting Q_(k)(Y'j|Pi(Y'j)) from Q_(k)'(Y',S) for each Y'j in Y' and updating its CPT (|Y'|>=(m+n)).
}
Variation 5:
(1) Getting Y={C1,C2,...,Cn,P1,P2,...,Pm}={Yj} and it's loose closure S={Pi(Yj)}\Y (j=1 to m+n);
(2) Q_(k)(Y,S) = Q_(k-1)(Y,S) * R(A|B) / Q_(k-1)(A|B);
(3) Getting Q_(k)(Yj|Pi(Yj)) from Q_(k)(Y,S) for each Yj in Y and updating its CPT (j=1 to m+n).
Variation 6:
(1) Getting Y={C1,C2,...,Cn,P1,P2,...,Pm}={Yj} and it's loose closure S={Pi(Yj)}\Y (j=1 to m+n);
(2) Do until converge { //Q_(k)(Y,S) ~= Q_(k)'(Y,S)
Q_(k)'(Y,S) = Q_(k-1)(Y,S) * R(A|B) / Q_(k-1)(A|B),
Getting Q_(k)(Yj|Pi(Yj)) from Q_(k)'(Y,S) for each Yj in Y and updating its CPT (j=1 to m+n).
}
Variation 7:
(1) Getting Y={C1,C2,...,Cn,P1,P2,...,Pm}={Yj}, it's tight closure S, and a updated variable set Y', please refer to 'RetrieveTightClosure.java';
(2) Q_(k)(Y',S) = Q_(k-1)(Y',S) * R(A|B) / Q_(k-1)(A|B);
(3) Getting Q_(k)(Y'j|Pi(Y'j)) from Q_(k)(Y',S) for each Y'j in Y' and updating its CPT (|Y'|>=(m+n)).
Variation 8:
(1) Getting Y={C1,C2,...,Cn,P1,P2,...,Pm}={Yj}, it's tight closure S, and a updated variable set Y', please refer to 'RetrieveTightClosure.java';
(2) Do until converge { //Q_(k)(Y',S) ~= Q_(k)'(Y',S)
Q_(k)'(Y',S) = Q_(k-1)(Y',S) * R(A|B) / Q_(k-1)(A|B),
Getting Q_(k)(Y'j|Pi(Y'j)) from Q_(k)'(Y',S) for each Y'j in Y' and updating its CPT (|Y'|>=(m+n)).
}
This class implements the 'D-IPFP' algorithm based on the UAI-2005 paper,
to process only one marginal constraint with the form 'R(Y)', 'Y={C1, C2, ..., Cn}'.
Eight(8) variations of implementation are provided, for experimental and analytical purpose.
Marginal Constraint provided might be either: (C, C1, C2, ...,Cn are variables)
(1) Local: R(C), or, R(C,L) and L is a non-empty subset of Pi(C);
(2) Non-Local: R(C1,C2,...,Cn), n>=2.
Variation 1:
(1) Judge whether this constraint is local or non-local;
(2) If local, updating C's CPT only, using Q_(k)(C|Pi(C)) = Q_(k-1)(C|Pi(C)) * R(C,L) / Q_(k-1)(C,L), then normalize to 1;
(3) If non-local: (n>=2)
Getting Y={C1,C2,...,Cn} and it's loose closure S={Pi(Cj)}\Y (j=1 to n),
Q_(k)(Y,S) = Q_(k-1)(Y,S) * R(Y) / Q_(k-1)(Y),
Getting Q_(k)(Cj|Pi(Cj)) from Q_(k)(Y,S) for each Cj in Y and updating its CPT (j=1 to n).
Variation 2: //Default: This is exactly the algorithm in the UAI-2005 paper.
(1) Judge whether this constraint is local or non-local;
(2) If local, updating C's CPT only, using Q_(k)(C|Pi(C)) = Q_(k-1)(C|Pi(C)) * R(C,L) / Q_(k-1)(C,L), then normalize to 1;
(3) If non-local: (n>=2)
Getting Y={C1,C2,...,Cn} and it's loose closure S={Pi(Cj)}\Y (j=1 to n),
Do until converge { //Q_(k)(Y,S) ~= Q_(k)'(Y,S)
Q_(k)'(Y,S) = Q_(k-1)(Y,S) * R(Y) / Q_(k-1)(Y),
Getting Q_(k)(Cj|Pi(Cj)) from Q_(k)'(Y,S) for each Cj in Y and updating its CPT (j=1 to n).
}
Variation 3:
(1) Judge whether this constraint is local or non-local;
(2) If local, updating C's CPT only, using Q_(k)(C|Pi(C)) = Q_(k-1)(C|Pi(C)) * R(C,L) / Q_(k-1)(C,L), then normalize to 1;
(3) If non-local: (n>=2)
Getting a tight closure S of Y, and a updated variable set Y', please refer to 'RetrieveTightClosure.java',
Q_(k)(Y',S) = Q_(k-1)(Y',S) * R(Y) / Q_(k-1)(Y),
Getting Q_(k)(Cj|Pi(Cj)) from Q_(k)(Y',S) for each Cj in Y' and updating its CPT (|Y'|>=n).
Variation 4:
(1) Judge whether this constraint is local or non-local;
(2) If local, updating C's CPT only, using Q_(k)(C|Pi(C)) = Q_(k-1)(C|Pi(C)) * R(C,L) / Q_(k-1)(C,L), then normalize to 1;
(3) If non-local: (n>=2)
Getting a tight closure S of Y, and a updated variable set Y', please refer to 'RetrieveTightClosure.java',
Do until converge { //Q_(k)(Y',S) ~= Q_(k)'(Y',S)
Q_(k)'(Y',S) = Q_(k-1)(Y',S) * R(Y) / Q_(k-1)(Y),
Getting Q_(k)(Cj|Pi(Cj)) from Q_(k)'(Y',S) for each Cj in Y' and updating its CPT (|Y'|>=n).
}
Variation 5: (treat local and non-local marginal constraint as the same, n>=1)
(1) Getting Y={C1,C2,...,Cn} and it's loose closure S={Pi(Cj)}\Y (j=1 to n);
(2) Q_(k)(Y,S) = Q_(k-1)(Y,S) * R(Y) / Q_(k-1)(Y);
(3) Getting Q_(k)(Cj|Pi(Cj)) from Q_(k)(Y,S) for each Cj in Y and updating its CPT (j=1 to n).
Variation 6: (treat local and non-local marginal constraint as the same, n>=1)
(1) Getting Y={C1,C2,...,Cn} and it's loose closure S={Pi(Cj)}\Y (j=1 to n);
(2) Do until converge { //Q_(k)(Y,S) ~= Q_(k)'(Y,S)
Q_(k)'(Y,S) = Q_(k-1)(Y,S) * R(Y) / Q_(k-1)(Y),
Getting Q_(k)(Cj|Pi(Cj)) from Q_(k)'(Y,S) for each Cj in Y and updating its CPT (j=1 to n).
}
Variation 7: (treat local and non-local marginal constraint as the same, n>=1)
(1) Getting a tight closure S of Y, and a updated variable set Y', please refer to 'RetrieveTightClosure.java';
(2) Q_(k)(Y',S) = Q_(k-1)(Y',S) * R(Y) / Q_(k-1)(Y);
(3) Getting Q_(k)(Cj|Pi(Cj)) from Q_(k)(Y',S) for each Cj in Y' and updating its CPT (|Y'|>=n).
Variation 8: (treat local and non-local marginal constraint as the same, n>=1)
(1) Getting a tight closure S of Y, and a updated variable set Y', please refer to 'RetrieveTightClosure.java';
(2) Do until converge { //Q_(k)(Y',S) ~= Q_(k)'(Y',S)
Q_(k)'(Y',S) = Q_(k-1)(Y',S) * R(Y) / Q_(k-1)(Y),
Getting Q_(k)(Cj|Pi(Cj)) from Q_(k)'(Y',S) for each Cj in Y' and updating its CPT (|Y'|>=n).
}