GetPTabular( TokArr node, TokArr parents ) seems to
have an implicit assumption about the order in which
the parent states are listed in TokArr "parents" in
order to yield the correct result.
Example: (see attached file)
Node Y has 2 parents: X and Z
P( Y=True | X=True, Z=False ) = 0.1
P( Y=True | Z=True, X=False ) = 0.89
For the attached file GetPTabular gives the following
results:
Request 1: GetPTabular( "Y^True","X^True Z^False");
Result 1: X^True^Z^False^Y^True^0.100000
Correct result!
Request 2: GetPTabular( "Y^True","Z^False X^True");
Result 2: Z^False^X^True^Y^True^0.890000
Result incorrect! Should also be 0.10000!
Request 3: GetPTabular( "Y^True","X^False Z^True");
Result 3: X^False^Z^True^Y^True^0.890000
Correct result. This is where Request 2 got its value!
Thus, GetPTabular yields the correct result above only
if the state of X is prescribed BEFORE the state of Z
in the input string. (I tested this for various other
cases and the order seems to be the only factor.)
What is particularly confusing is the fact that the
nodenames of the parents have to be used in the input.
And while they are apparently NOT used in the
calculation, they ARE used again to generate the output
string. Thus looking at the ouput
string, one gets the impression that the correct
request was processed.
Example demonstrating problem with GetPTabular