This notebook was inspired into CITE and its course at Coursera and Stanford University.
In [24]:
from nxpd import draw
import networkx as nx
In [25]:
def draw_graph(
graph, labels=None
):
# create networkx graph
G = nx.DiGraph()
G.graph['dpi'] = 120
G.add_nodes_from(set([
graph[k1][k2]
for k1 in range(len(graph))
for k2 in range(len(graph[k1]))
]))
G.add_edges_from(graph)
return draw(G, show='ipynb')
For events $\alpha,\beta$, $P \vdash \alpha \perp \beta$ if:
\begin{equation} P(\alpha, \beta) = P(\alpha) P(\beta)\\ P(\alpha| \beta) = P(\alpha)\\ P(\beta|\alpha) = P(\beta)\\ \end{equation}For (sets of) random variable $X, Y, Z$
$P \vdash (X \perp Y | Z) if:$
\begin{equation} P(X, Y|Z) = P(X|Z) P(Y|Z)\\ P(X|Y, Z) = P(X|Z)\\ P(Y|X, Z) = P(Y|Z)\\ P(X, Y, Z) \propto \phi_1(X, Z) \phi_2(Y, Z) \end{equation}
In [29]:
# Graphs
graph = [('Coin', 'X1'), ('Coin', 'X2')]
draw_graph(graph)
Out[29]: