Member-only story
In this article, we will re-visit the concept of D-separation in Bayesian Networks. We have already understood it conceptually, so let us now try to see how we can implement it by using Python.
Remembering D-separation
So, what exactly was D-separation in context to Bayesian Networks and what can it be used for? Simply said, it is a more formal procedure for determining independence. In other words, if two variables are d-separated relative to a set of variables, Z, in a directed graph, then they are independent conditional on Z in all probability distributions such a graph can represent. What does this mean? It means that two variables X and Y are independent conditional on Z if knowledge about X gives you no extra information about Y once you have knowledge of Z.
To completely understand how it is done, we will first need to talk about active and inactive trails. Intuitively, we can say that a path is active if it implies dependence. Two variables, X and Y, might be connected by multiple paths in a graph, where some or none are active. If none of the paths are active then X and Y are D-separated. We found out that we have the following four base-cases for active and non-active trails:
The algorithm to determine D-separation was given by the following: