From a probabilistic point of view, two variables A and B are independent if

**Pr[A=v]=Pr[A=v|B=u]**

So, to check the independence of two variables, one has to compute the conditional probability and compare to the probability without the added condition.

A quick solution is to model the Bayes network with a python script you may find on my github. The result shows that B and C are dependent if A and D are known, but independent if only A is known.

P(B)= 0.590436

P(B|C)= 0.464383811907

P(C)= 0.629475

P(C|B)= 0.49508837537

P(C,(D))= 0.650509052716

P(C|B,(D))= 0.554403493324

P(B,(D))= 0.704196855276

P(B|C,(D))= 0.600159513419

P(C,(A))= 0.448997199205

P(C|B,(A))= 0.449069612702

P(B,(A))= 0.949959858907

P(B|C,(A))= 0.9501130668

P(C,(A,D))= 0.174715296242

P(C|B,(A,D))= 0.139904742675

P(B,(A,D))= 0.844759945818

P(B|C,(A,D))= 0.676448630334

P(B)= 0.590436

P(B|C)= 0.464383811907

P(C)= 0.629475

P(C|B)= 0.49508837537

P(C,(D))= 0.650509052716

P(C|B,(D))= 0.554403493324

P(B,(D))= 0.704196855276

P(B|C,(D))= 0.600159513419

P(C,(A))= 0.448997199205

P(C|B,(A))= 0.449069612702

P(B,(A))= 0.949959858907

P(B|C,(A))= 0.9501130668

P(C,(A,D))= 0.174715296242

P(C|B,(A,D))= 0.139904742675

P(B,(A,D))= 0.844759945818

P(B|C,(A,D))= 0.676448630334

In order to double check, I did the formal calculation for the case where A and D are known, which gave me the same results.

Python rocks! And so does the Stanford AI course!

## No comments:

## Post a Comment