\begin{frame}
	\myheading{Module 17.5: Different types of reasoning in a Bayesian network}
\end{frame}

\begin{frame}
	\begin{block}{New Notations}
		\begin{itemize}
			\onslide<1->{\item We will denote $P(I=0)$ by $P(i^{0})$}
			\onslide<2->{\item In general, we will denote $P(I=0, D=1, G=B, S=1, L=0)$ by $P(i^{0},d^{1},g^{b},s^{1},l^{0})$}
		\end{itemize}
	\end{block}
\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			%\vspace{-0.2in}
			\input{modules/Module4/tikz_images/table_net.tex}
			\begin{align*}
			  	P(l^1)&=\sum_{I,D,G,S} P(I,D,G,S,l^1)\\
		  		&=\sum_{I\epsilon(0,1)}\sum_{D\epsilon(0,1)}\sum_{G\epsilon(A,B,C)}\sum_{S\epsilon(0,1)} P(I,D,G,S,l^1)\\
			  	&=50.2\%
			 \end{align*}
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			%\vspace{0.2in}
			\textbf{Causal Reasoning}
			\begin{itemize}\justifying
				\onslide<1->{\item Here, we try to predict downstream effects of various factors}
				\onslide<2->{\item Let us consider an example}
				\onslide<3->{\item What is the probability that a student will get a good recommendation letter, $P(l^{1})$?\\}
				
				%\onslide<4->{\item Now what if we start adding information about the factors that could influence $l^{1}$}
			\end{itemize}
			\begin{align*}
%				\onslide<4->{P(l^{1})=0.9(P(g^1))+0.6(P(g^2))\\
%				+0.01(P(g^3))\\}
%				\onslide<5->{\text{where } P(g^1)=0.3(P(i^0,d^0))+...\\
%				+0.5(P(i^1,d^1))}
%				\onslide<5->{\text{ and so on}\\}
				\onslide<4->{%P(l^1)=\sum_{I,D,G,S} P(I,D,G,S,l^1)\\
				\hspace{-0.4in}	P(l^1)=\sum_{I\epsilon(0,1)}\sum_{D\epsilon(0,1)}\sum_{S\epsilon(0,1)}\sum_{G\epsilon(A,B,C)}P(I,D,G,S,l^1)}
%				\onslide<7->{P(l^1)= 0.502}
			\end{align*}
%			\onslide<4->{$P(l^{1})=0.9(P(g^1))+0.6(P(g^2))+0.01(P(g^3))$\\}
%			\onslide<5>{where $P(g^1)=0.3(P(i^0,d^0))+...+0.5(P(i^1,d^1))$}
			%\onslide<7->{$P(l^1)= 0.502$}
		\end{overlayarea}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{overlayarea}{\textwidth}{0.5\textheight}
		\begin{align*}
		\onslide<1->{P(l^1) &=\sum_{I\epsilon(0,1)}\sum_{D\epsilon(0,1)}\sum_{S\epsilon(0,1)}\sum_{G\epsilon(A,B,C)}P(I,D,G,S,l^1)\\}
		\onslide<2->{&=\sum_{I\epsilon(0,1)}P(I)\sum_{D\epsilon(0,1)}P(D|I)\sum_{S\epsilon(0,1)} P(S|I,D)\sum_{G\epsilon(A,B,C)}P(G|I,D,S).P(l^1|G,I,D,S)\\}
		\onslide<3->{&=\sum_{I\epsilon(0,1)}P(I)\sum_{D\epsilon(0,1)}P(D)\sum_{S\epsilon(0,1)} P(S|I)\sum_{G\epsilon(A,B,C)}P(G|I,D).P(l^1|G)\\}
		\end{align*}
	\end{overlayarea}
	\begin{overlayarea}{\textwidth}{0.5\textheight}
		\begin{columns}
			\column{0.50\textwidth}
			\begingroup
			\tikzset{every picture/.style={scale=0.7}}
			\input{modules/Module6/tikz_images/deep_thin_net.tex}
			\endgroup
			\column{0.50\textwidth}
		\end{columns}
	\end{overlayarea}
\end{frame}

\begin{frame}
	\begin{overlayarea}{\textwidth}{0.5\textheight}
		\small{ \begin{align*}
			\hspace{-0.8in}
			\onslide<1->{P(l^1)&=\sum_{I\epsilon(0,1)}P(I)\sum_{D\epsilon(0,1)}P(D)\sum_{S\epsilon(0,1)}P(S|I)\text{$\color{red}\sum_{G\epsilon(A,B,C)}P(G|I,D)P(l^1|G)$}\\}
			\onslide<2->{ &=\sum_{I\epsilon(0,1)}P(I)\sum_{D\epsilon(0,1)}P(D)\sum_{S\epsilon(0,1)}P(S|I)\text{$\color{red}0.9(P(g^1|I,D))+0.6(P(g^2|I,D))+0.01(P(g^3|I,D))$}\\}
		\end{align*}
		}
	\begin{itemize}
		\vspace{-0.4in}
		\onslide<3->{\item Similarly using the other tables, we can evaluate this equation}
	\end{itemize}
	\onslide<4->{$$P(l^1)=0.502$$}
	
	\end{overlayarea}
\begin{overlayarea}{\textwidth}{0.5\textheight}
	\begin{columns}
		\column{0.30\textwidth}
		\begingroup
		\tikzset{every picture/.style={scale=0.7}}
		\input{modules/Module6/tikz_images/deep_thin_net.tex}
		\endgroup
		\column{0.30\textwidth}
		\onslide<1->{
			\begin{tabular}{|c|c|c|}
				\hline
				\rule{0pt}{0.25cm}& $l^0$ & $l^1$\\
				\hline
				$g^1$ & 0.1 & 0.9\\
				\hline
				$g^2$ & 0.4 & 0.6\\
				\hline
				$g^3$ & 0.99 & 0.01\\
				\hline
			\end{tabular}
		}
	\column{0.30\textwidth}
		\onslide<3->{
			\begin{tabular}{|c|c|c|c|}
				\hline
				\rule{0pt}{0.25cm}&$g^1$ & $g^2$ & $g^3$\\
				\hline
				$i^0$,$d^0$ & 0.3 & 0.4 & 0.3\\
				\hline
				$i^0$,$d^1$ & 0.05 & 0.25 & 0.7\\
				\hline
				$i^1$,$d^0$ & 0.9 & 0.08 & 0.02\\	
				\hline
				$i^1$,$d^1$ & 0.5 & 0.3 & 0.2\\
				\hline
			\end{tabular}
		}
	\end{columns}
\end{overlayarea}
\end{frame}


%\begin{frame}
%	\begin{columns}
%		\column{0.10\textwidth}
%		\begin{overlayarea}{\textwidth}{\textheight}
%			\begingroup
%			\tikzset{every picture/.style={scale=0.7}}%
%			\input{modules/Module6/tikz_images/deep_thin_net.tex}%
%			\endgroup
%		%\input{modules/Module6/tikz_images/deep_thin_net.tex}
%		\end{overlayarea}
%		\column{0.90\textwidth}
%		\begin{overlayarea}{\textwidth}{\textheight}
%			\begin{align*}
%				\onslide<1->{P(l^1) &=\sum_{I\epsilon(0,1)}\sum_{D\epsilon(0,1)}\sum_{S\epsilon(0,1)}\sum_{G\epsilon(A,B,C)}P(I,D,G,S,l^1)\\}
%				\onslide<2->{\vspace{-0.4in}&=\sum_{I\epsilon(0,1)}P(I)\sum_{D\epsilon(0,1)}P(D|I)\sum_{S\epsilon(0,1)} P(S|I,D)\sum_{G\epsilon(A,B,C)}P(G|I,D,S)P(l^1|G,I,D,S)\\}
%			\end{align*}
%		\end{overlayarea}
%	\end{columns}
%\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\input{modules/Module4/tikz_images/table_net.tex}
%			\vspace{0.2in}
%			\begin{align*}
%				\tiny& P(l^1)= 0.502\\
%     			& P(l^1|i^0)= 0.389 (drops) \\
%    			& P(l^1|i^0,d^1)= 0.513 (increases)
%			\end{align*}
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			%\vspace{0.2in}
			\textbf{Causal Reasoning}
			\begin{itemize}\justifying
				\onslide<1->{\item Now what if we start adding information about the factors that could influence $l^{1}$}
				\onslide<2->{\item What if someone reveals that the student is not intelligent?}
				\onslide<3->{\item Intelligence will affect the score and hence the grade}
				%\only<6->{Indeed $P(l^1|i^0)= 0.389$ (drops)}
%				\onslide<3->{\item What if the course was easy?}
%				\onslide<4->{\item A not so intelligent student may still be able to get a good grade and hence a goodl letter.}
			\end{itemize}
			%\hspace{-0.5in}
% 			\begin{align*}
% 			\onslide<4->{P(l^{1}|i^0)=0.9(P(g^1))+0.6(P(g^2))\\
% 				+0.01(P(g^3))\\}
% 			\only<5>{\text{where now } P(g^1)=0.3(P(i^0,d^0))\\
% 				+0.5(P(i^0,d^1))\\}
% 			\onslide<6->{%P(l^1)=\sum_{I,D,G,S} P(I,D,G,S,l^1)\\
% 				\hspace{-0.3in}	P(l^1|i^0)=\sum_{D\epsilon(0,1)}\sum_{G\epsilon(A,B,C)}\sum_{S\epsilon(0,1)} P(i^0,D,G,S,l^1)}
% %			\only<6->{P(l^1|i^0)= 0.389 (drops)}
% 			\end{align*}
% 			%\hspace{-0.2in}
% 			\onslide<7->{Indeed $P(l^1|i^0)= 0.389$ (drops)}
		\end{overlayarea}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{overlayarea}{\textwidth}{0.5\textheight}
		% \small{ \begin{align*}
		% 	\hspace{-0.8in}
		% 	\onslide<1->{P(l^1)&=\sum_{I\epsilon(0,1)}P(I)\sum_{D\epsilon(0,1)}P(D)\sum_{S\epsilon(0,1)}P(S|I)\text{$\color{red}\sum_{G\epsilon(A,B,C)}P(G|I,D)P(l^1|G)$}\\}
		% 	\onslide<2->{ &=\sum_{I\epsilon(0,1)}P(I)\sum_{D\epsilon(0,1)}P(D)\sum_{S\epsilon(0,1)}P(S|I)\text{$\color{red}0.9(P(g^1|I,D))+0.6(P(g^2|I,D))+0.01(P(g^3|I,D))$}\\}
		% \end{align*}
		% }
		\footnotesize{\begin{align*}
					P(l^{1}|i^{0}) &= \frac{P(l^{1},i^{0})}{P(i^{0})} \\
					\onslide<2->{P(l^{1},i^{0}) &= \sum_{D \in \{0,1\}}\sum_{S \in \{0,1\}}\sum_{G \in \{A,B,C\}}P(i^{0},D,G,S,l^{1})} \\
								   \onslide<3->{&= \sum_{D \in \{0,1\}}P(D)\sum_{S \in \{0,1\}}P(S|i^{0})\sum_{G \in \{A,B,C\}}\textcolor{red}{P(G|D,i^{0})P(l^{1}|G) }}\\
								   \onslide<4->{&= \sum_{D \in \{0,1\}}P(D)\sum_{S \in \{0,1\}}P(S|i^{0})\sum_{G \in \{A,B,C\}}\textcolor{red}{0.9P(g^{1}|D,i^{0})+0.6P(g^{2}|D,i^{0})+0.01P(g^{3}|D,i^{0})}}\\
					\onslide<5->{P(l^1|i^{0})&=0.389}
				\end{align*}}
	% \begin{itemize}
		% \vspace{-0.4in}
		% \onslide<5->{\item Similarly using the other tables, we can evaluate this equation}
	% \end{itemize}
	% \onslide<6->{$$P(l^1|i^{0})=0.389$$}
	
	\end{overlayarea}
\begin{overlayarea}{\textwidth}{0.5\textheight}
	\begin{columns}
		\column{0.30\textwidth}
		\begingroup
		\tikzset{every picture/.style={scale=0.7}}
		\input{modules/Module6/tikz_images/deep_thin_net.tex}
		\endgroup
		\column{0.30\textwidth}
		\onslide<4->{
			\begin{tabular}{|c|c|c|}
				\hline
				\rule{0pt}{0.25cm}& $l^0$ & $l^1$\\
				\hline
				$g^1$ & 0.1 & 0.9\\
				\hline
				$g^2$ & 0.4 & 0.6\\
				\hline
				$g^3$ & 0.99 & 0.01\\
				\hline
			\end{tabular}
		}
	\column{0.30\textwidth}
		\onslide<4->{
			\begin{tabular}{|c|c|c|c|}
				\hline
				\rule{0pt}{0.25cm}&$g^1$ & $g^2$ & $g^3$\\
				\hline
				$i^0$,$d^0$ & 0.3 & 0.4 & 0.3\\
				\hline
				$i^0$,$d^1$ & 0.05 & 0.25 & 0.7\\
				\hline
				$i^1$,$d^0$ & 0.9 & 0.08 & 0.02\\	
				\hline
				$i^1$,$d^1$ & 0.5 & 0.3 & 0.2\\
				\hline
			\end{tabular}
		}
	\end{columns}
\end{overlayarea}
\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\input{modules/Module4/tikz_images/table_net.tex}
			
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			%\vspace{0.2in}
			\textbf{Causal Reasoning}
			\begin{itemize}\justifying
				\onslide<1->{\item What if the course was easy?}
				%\onslide<2->{\item What if someone reveals that the student is not intelligent?}
				%\onslide<3->{\item Intelligence will affect the score and hence the grade}
				%\only<6->{Indeed $P(l^1|i^0)= 0.389$ (drops)}
				%				\onslide<3->{\item What if the course was easy?}
				\onslide<2->{\item A not so intelligent student may still be able to get a good grade and hence a good letter}
			\end{itemize}
			\begin{align*}
%			\onslide<4->{P(l^{1}|i^0)=0.9(P(g^1))+0.6(P(g^2))\\
%				+0.01(P(g^3))\\}
%			\only<5->{\text{where now } P(g^1)=0.3(P(i^0,d^0))\\
%				+0.5(P(i^0,d^1))}
			\onslide<3->{\hspace{-0.2in}	P(l^1|i^0,d^0)=\sum_{G\epsilon(A,B,C)}\sum_{S\epsilon(0,1)} P(i^0,d^0,G,S,l^1)}
			%			\only<6->{P(l^1|i^0)= 0.389 (drops)}
			%\onslide<4->{P(l^1|i^0,d^1)= 0.513 (increases)}
			\end{align*}
			\onslide<4->{\hspace{0.2in}$P(l^1|i^0,d^1)= 0.513$ (increases)}
		\end{overlayarea}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			%\vspace{-0.2in}
			\input{modules/Module4/tikz_images/table_net.tex}
			%\vspace{0.2in}
			
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\textbf{Evidential Reasoning}
			\begin{itemize}\justifying
				\onslide<1->{\item Here, we reason about causes by looking at their effects}
				\onslide<2->{\item What is the probability of the student being intelligent?}
				\onslide<4->{\item What is the probability of the course being difficult?}
				\onslide<6->{\item Now let us see what happens if we observe some effects}
			\end{itemize}
			\begin{align*}
			\only<2>{& P(i^1)= ?\\
			}
			\onslide<3->{& P(i^1)= 0.3\\}
			\only<4>{& P(d^1)= ?\\
			}
			\onslide<5->{& P(d^1)= 0.4  \\}
			\end{align*}
		\end{overlayarea}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{-0.1in}
			\small {
			\begin{align*}
			     & P(i^1)= 0.3\\
			     & P(d^1)= 0.4  \\
			     \onslide<2->{& P(i^1|g^3)= 0.079 (drops) \\}
			     \onslide<2->{& P(d^1|g^3)= 0.629 (increases) \\}
			     \onslide<4->{& P(i^1|l^0)= 0.14 (drops)\\}
			     \onslide<6->{& P(l^1|l^0,g^3)= 0.079\\ }
			     \onslide<6->{& (\text{same as }P(i^1|g^3))}
		     \end{align*}
		     }
		    \vspace{-0.4in}
			\input{modules/Module4/tikz_images/deep_thin_net_small.tex}
			 
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\textbf{Evidential Reasoning}
			\begin{itemize}\justifying
				\onslide<1->{\item What if someone tells us that the student secured $C$ grade?}
				\onslide<3->{\item What if instead of getting to know the grade, we get to know that the student got a poor recommendation letter?}
				\onslide<5->{\item What if we know about the grade as well as the recommendation letter?}
				\onslide<7->{\item The last case is interesting! (We will return to it later)}
			\end{itemize}
		\end{overlayarea}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{-0.1in}
			\begin{align*}
				& P(i^1)= 0.3\\
				\onslide<2->{& P(i^1|g^3)= 0.079 (drops) \\}
				\onslide<4->{& P(i^1|g^3,d^1)= 0.11 (improves) \\}
			\end{align*}
			\vspace{-0.4in}
			\input{modules/Module4/tikz_images/deep_thin_net_small.tex}
			
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\textbf{Explaining Away}
			\begin{itemize}\justifying
				\onslide<1->{\item Here, we see how different causes of the same effect can interact}
				\onslide<2->{\item We already saw how knowing the grade influences our estimate of intelligence}
				\onslide<3->{\item What if we were told the course was difficult?}
				\onslide<4->{\item Our belief in the student's intelligence improves}
				\onslide<5->{\item Why? Let us see}
			\end{itemize}
		\end{overlayarea}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{-0.1in}
			\begin{align*}
			 	& P(i^1)= 0.3\\
			 	& P(i^1|g^3)= 0.079 \\
			 	& P(i^1|g^3,d^1)= 0.11\\
			  	\onslide<5>{& P(i^1|g^2)= 0.175 \\
			  		& P(i^1|g^2,d^1)= 0.34} 
			 \end{align*}
			 \vspace{-0.4in}
			\input{modules/Module4/tikz_images/deep_thin_net_small.tex}
			
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\textbf{Explaining Away}
			\begin{itemize}\justifying
				\onslide<1->{\item Knowing that the course was difficult explains away the bad grade}
				\onslide<2->{\item ``Oh! Maybe the course was just too difficult and the student might have received a bad grade despite being intelligent!"}
				\onslide<3->{\item The explaining away effect could be even more dramatic}
				\onslide<4->{\item Let us consider the case when the grade was $B$}				
			\end{itemize}
		\end{overlayarea}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{-0.1in}
			\begin{align*}
			     & P(d^1)= 0.40\\
			     & P(d^1|g^3)= 0.629 \\
			     \onslide<2->{& P(d^1|s^1,g^3)= 0.76}
	         \end{align*}
	         \vspace{-0.4in}
			\input{modules/Module4/tikz_images/deep_thin_net_small.tex}
			 
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\textbf{Explaining Away}
			\begin{itemize}\justifying
				\onslide<1->{\item Suppose we know that the student had a high SAT Score, what happens to our belief about the difficulty of the course?}
				\onslide<3->{\item Knowing that the SAT score was high tells us that the student seems intelligent and perhaps the reason why he scored a poor grade is that the course was difficult}
			\end{itemize}
		\end{overlayarea}
	\end{columns}
\end{frame}

