Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.61 KB | None | 0 0
  1. \section{D-separation algorithm.}
  2. Using the d-separation algorithm we want to prove that D(Good Diet) and F(Little Free Time) are conditionally independent, if W(Overweight) and R(Reduced Stress) are given.
  3. \subsection{First step: Draw the ancestral graph}
  4. \begin{center}
  5. \begin{tikzpicture}[
  6. node/.style={ellipse, draw=black!120, fill=gray!10, very thick, minimum size=14mm},
  7. ]
  8. %Nodes
  9. \node[node] (lft) {Little Free Time};
  10. \node[node] (ex) [below=of lft] {Exercise};
  11. \node[node] (gd) [right=of ex] {Good Diet};
  12. \node[node] (rs) [left=of hc] {Reduced Stress};
  13. \node[node] (ow) [right=of hc] {Overweight};
  14.  
  15. %Lines
  16. \draw[->] (lft.south) -- (ex.north);
  17. \draw[->] (ex.south) -- (rs.north);
  18. \draw[->] (ex.south) -- (ow.north);
  19. \draw[->] (gd.south) -- (ow.north);
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26. \end{tikzpicture}
  27. \end{center}
  28.  
  29. \subsection{Second step: Moralize}
  30. \begin{center}
  31. \begin{tikzpicture}[
  32. node/.style={ellipse, draw=black!120, fill=gray!10, very thick, minimum size=14mm},
  33. ]
  34. %Nodes
  35. \node[node] (lft) {Little Free Time};
  36. \node[node] (ex) [below=of lft] {Exercise};
  37. \node[node] (gd) [right=of ex] {Good Diet};
  38. \node[node] (rs) [left=of hc] {Reduced Stress};
  39. \node[node] (ow) [right=of hc] {Overweight};
  40.  
  41. %Lines
  42. \draw[->] (lft.south) -- (ex.north);
  43. \draw[->] (ex.south) -- (rs.north);
  44. \draw[->] (ex.south) -- (ow.north);
  45. \draw[->] (gd.south) -- (ow.north);
  46. \draw[-] (gd.west) -- (ex.east);
  47.  
  48. \end{tikzpicture}
  49. \end{center}
  50.  
  51. \subsection{Third step: Disorient}
  52. \begin{center}
  53. \begin{tikzpicture}[
  54. node/.style={ellipse, draw=black!120, fill=gray!10, very thick, minimum size=14mm},
  55. ]
  56. %Nodes
  57. \node[node] (lft) {Little Free Time};
  58. \node[node] (ex) [below=of lft] {Exercise};
  59. \node[node] (gd) [right=of ex] {Good Diet};
  60. \node[node] (rs) [left=of hc] {Reduced Stress};
  61. \node[node] (ow) [right=of hc] {Overweight};
  62.  
  63. %Lines
  64. \draw[-] (lft.south) -- (ex.north);
  65. \draw[-] (ex.south) -- (rs.north);
  66. \draw[-] (ex.south) -- (ow.north);
  67. \draw[-] (gd.south) -- (ow.north);
  68. \draw[-] (gd.west) -- (ex.east);
  69.  
  70. \end{tikzpicture}
  71. \end{center}
  72.  
  73. \subsection{Fourth step: Delete givens}
  74. \begin{center}
  75. \begin{tikzpicture}[
  76. node/.style={ellipse, draw=black!120, fill=gray!10, very thick, minimum size=14mm},
  77. ]
  78. %Nodes
  79. \node[node] (lft) {Little Free Time};
  80. \node[node] (ex) [below=of lft] {Exercise};
  81. \node[node] (gd) [right=of ex] {Good Diet};
  82.  
  83. %Lines
  84. \draw[-] (lft.south) -- (ex.north);
  85. \draw[-] (gd.west) -- (ex.east);
  86.  
  87. \end{tikzpicture}
  88. \end{center}
  89.  
  90. \subsection{Results}
  91. \paragraph{} As the variables are connected, they are Bayes dependent. The result was verified using the implementation of the d-separation algorithm in Python.\footnote{Code of the algorithm:.https://github.com/lingxuez/bayes-net.}
  92. Inputs(number of nodes, edges, queries):
  93. \begin{center}
  94. \newline 6 6 1
  95. \newline F E
  96. \newline E R
  97. \newline E W
  98. \newline D W
  99. \newline E H
  100. \newline D H
  101. \newline D F \mid W R
  102. \end{center}
  103. \paragraph{} The output is: False. That means that D and F are not conditionally independent, confirming the above manual tracing of the algorithm.
  104.  
  105. \section{Exact inference by enumeration.}
  106. \paragraph{}
  107. The probability that is going to be computed is the probability of having a good diet, given that the person is not overweight and has high cholesterol level.
  108. This algorithm uses the sums of hidden variables, which in this case are F(Little Free Time) and E(Exercise).
  109.  
  110.  
  111. Rewriting full joint entries using product of CPT entries:
  112. \[ P(D|\neg W, R) = \alpha * \sum_{F} \sum_{E} P(D, F, E, \neg W, R) \]
  113. \[ P(D|\neg W, R) = \alpha * \sum_{F} \sum_{E} P(D)* P(F) * P(E|F) * P(\neg W|D, E) * P(R|E) \]
  114. \[ = \alpha * P(D) * \sum_{F} \sum_{E} P(F) * P(E|F) * P(\neg W|D, E) * P(R|E) \]
  115. \[ = \alpha * P(D) * [ (P(F) * P(E|F) * P(\neg W|D, E) * P(R|E) + P(F) * P(\neg E|F) * P(\neg W|D, \neg E) * P(R|\neg E))\]
  116. \[+ (P(\neg F) * P(E|\neg F) * P(\neg W|D, E) * P(R|E) + P(\neg F) * P(\neg E|\neg F) * P(\neg W|D, \neg E) * P(R|\neg E))]\]
  117. \[ = \alpha * 0.4 * [0.8 * 0.1 * 0.95 * 0.95 + 0.8 * 0.9 * 0.15 * 0.45 + 0.2 * 0.7 * 0.95 * 0.95 + 0.2 * 0.3 * 0.15 * 0.45]\]
  118. \[ = \alpha * 0.4 * (0.0722 + 0.0486 + 0.12635 + 0.00405)\]
  119. \[ = \alpha * 0.4 * 0.2512 = \alpha * 0.10048 \]
  120.  
  121.  
  122. \[ P(\neg D|\neg W, R) = \alpha * \sum_{F} \sum_{E} P(\neg D, F, E, \neg W, R) \]
  123. \[ P(\neg D|\neg W, R) = \alpha * \sum_{F} \sum_{E} P(\neg D)* P(F) * P(E|F) * P(\neg W|\neg D, E) * P(R|E) \]
  124. \[ = \alpha * P(\neg D) * \sum_{F} \sum_{E} P(F) * P(E|F) * P(\neg W|\neg D, E) * P(R|E) \]
  125. \[ = \alpha * P(\neg D) * [ (P(F) * P(E|F) * P(\neg W|\neg D, E) * P(R|E) + P(F) * P(\neg E|F) * P(\neg W|\neg D, \neg E) * P(R|\neg E))\]
  126. \[+ (P(\neg F) * P(E|\neg F) * P(\neg W|\neg D, E) * P(R|E) + P(\neg F) * P(\neg E|\neg F) * P(\neg W|\neg D, \neg E) * P(R|\neg E))]\]
  127. \[ = \alpha * 0.6 * [0.8 * 0.1 * 0.35 * 0.95 + 0.8 * 0.9 * 0.99 * 0.45 + 0.2 * 0.7 * 0.35 * 0.95 + 0.2 * 0.3 * 0.99 * 0.45]\]
  128. \[ = \alpha * 0.6 * (0.0266 + 0.32076 + 0.04655 + 0.02673)\]
  129. \[ = \alpha * 0.6 * 0.42064 = \alpha * 0.252384 \]
  130. \[ \alpha = 1 / (0.10048 + 0.252384)\]
  131. \[ \alpha = 1 / 0.352864\]
  132. \[ P(D|\neg W, R) = 0.10048 / 0.352864 \approx 0.2847555\]
  133. The result can be verified in the output of seventh query from the listed code.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement