\begin{frame}
	\myheading{Module 17.3: Can we represent the joint distribution more compactly?}
\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\onslide<3->{\begin{tabular}{ |p{1cm}|p{1cm}|p{1cm}|}
							\hline
						    $I$ & $S$ &$P(I,S)$\\
							\hline
							0 & 0 & 0.665\\
							0 & 1 & 0.035\\
						    1 & 0 & 0.06\\
						    1 & 1 & 0.24\\
							\hline
						\end{tabular}}
			\begin{itemize}
				\onslide<5->{\item This distribution has $(2^2-1=3$) parameters.}
				\onslide<6->{\item Alternatively, the table has 4 rows but the last row is deterministic given the first 3 rows (or parameters)}
			\end{itemize}
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\begin{itemize}\justifying
				\onslide<1->{\item Consider the case of two random variables, Intelligence $(I)$ and SAT Scores $(S)$}
				\vspace{0.1in}
				\onslide<2->{\item Assume that both are binary and take values from {High$(1)$, Low$(0)$}}
				\vspace{0.1in}
				\onslide<3->{\item Here is one way of specifying the joint distribution}
				\vspace{0.1in}
				\onslide<4->{\item Of course, there are many such joint distributions possible}
			\end{itemize}
		\end{overlayarea}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\onslide<3->{\begin{tabular}{ |p{2cm}|p{1cm}|p{1cm}| }
							\hline                                                                  
						                                     
							     & $i=0$ & $i=1$\\                                
							\hline                                          	
							$P(I)$ & 0.7 & 0.3\\                                
							
							\hline                                      
							                                              
						\end{tabular}
						\newline
						\onslide<5->{\textcolor{blue}{no.of parameters=1}}
			
						\begin{tabular}{ |p{2cm}|p{1cm}|p{1cm}| }
										\hline
										 & $s=0$ & $s=1$\\ 
										 \hline
										  $P(S|I=0)$ & 0.95 & 0.05\\
										   \hline
										    $P(S|I=1)$ & 0.2 & 0.8\\
										 	\hline
										\end{tabular}
						\newline
						\onslide<5->{\textcolor{blue}{no.of parameters=2}}}
			\begin{itemize}\justifying
				\onslide<4->{\item What! So from 3 parameters we have gone to 6 parameters?} 
				\onslide<5->{\item Well, not really! (remember sum for each row in the above table has to be 1)}
				\onslide<6->{\item The number of parameters is still 3}
			\end{itemize}
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\begin{itemize}\justifying
				\onslide<1->{\item Note that there is a natural ordering in these two random variables}
				\vspace{0.1in}
				\onslide<2->{\item The SAT Score $(S)$ presumably depends upon the Intelligence $(I)$. An alternate and even more natural way to represent the same distribution is 
					\begin{align*}
						P(I,S) = P(I) \times P(S|I)
					\end{align*}}
				\onslide<3->{\item Instead of specifying the $4$ entries in $P(I,S)$, we can specify $2$ entries for $P(I)$ and $4$ entries for $P(S|I)$}
			\end{itemize}
		\end{overlayarea}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\begin{tabular}{ |p{2cm}|p{1cm}|p{1cm}| }
				\hline                                                                  
				
				& i=0 & i=1\\                                
				\hline                                          	
				$P(I)$ & 0.7 & 0.3\\                                
				
				\hline                                      
				
			\end{tabular}


			\textcolor{blue}{no.of parameters=1}

			\begin{tabular}{ |p{2cm}|p{1cm}|p{1cm}| }
				
				\hline
				& s=0 & s=1\\ 
				\hline
				$P(S|I=0)$ & 0.95 & 0.05\\
				\hline
				$P(S|I=1)$ & 0.2 & 0.8\\
				\hline
			\end{tabular}


			\textcolor{blue}{no.of parameters=2}
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\begin{itemize}\justifying
				\onslide<1->{\item What have we achieved so far? }
				\vspace{0.1in}
				\onslide<2->{\item We were not able to reduce the number of parameters}
				\vspace{0.1in}
				\onslide<3->{\item But, we have a more natural way of representing the distribution}
				\vspace{0.1in}
				\onslide<4->{\item This is known as conditional parameterization}
			\end{itemize}
		\end{overlayarea}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\begin{center}
				\begin{tikzpicture}
				    \node[hidden_neuron] at (0,4) {Intelligence};
				    \node[hidden_neuron] at (2,2.5) {Grade};
				    \node[hidden_neuron] at (-2,2.5) {SAT};
				\end{tikzpicture}
			\end{center}
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\begin{itemize}\justifying
				\onslide<1->{\item Now consider a third random variable Grade $(G)$}
				\vspace{0.1in}
				\onslide<2->{\item Notice that none of these $3$ variables are independent of each other}
				\vspace{0.1in}
				\onslide<3->{\item Grade and SAT Score are clearly correlated with Intelligence}
				\vspace{0.1in}
				\onslide<4->{\item Grade and SAT Score are also correlated because we would expect
								\begin{align*}
									P(G=1|S=1) > P(G=1|S=0)
								\end{align*}}
			\end{itemize}
		\end{overlayarea}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\begin{center}
				\begin{tikzpicture}
				    \node[hidden_neuron] at (0,4) {Intelligence};
				    \node[hidden_neuron] at (2,2.5) {Grade};
				    \node[hidden_neuron] at (-2,2.5) {SAT};
				\end{tikzpicture}
			\end{center}
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\begin{itemize}\justifying
				\onslide<1->{\item However, it is possible that the distribution satisfies a conditional independence}
				\vspace{0.1in}
				\onslide<2->{\item If we know that $I=H$, then it is possible that $S=H$ does not give any extra information for determining $G$}
				\vspace{0.1in}
				\onslide<3->{\item In other words, if we know that the student is intelligent we can make inferences about his grade without even knowing the SAT score}
				\onslide<4->{\item Formally, we assume that $(S \perp G | I)$}
				\vspace{0.1in}
				\onslide<5->{\item Note that this is just an assumption}
			\end{itemize}
		\end{overlayarea}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\begin{center}
				\begin{tikzpicture}
				    \node[hidden_neuron] at (0,4) {Intelligence};
				    \node[hidden_neuron] at (2,2.5) {Grade};
				    \node[hidden_neuron] at (-2,2.5) {SAT};
				\end{tikzpicture}
			\end{center}
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\begin{itemize}\justifying
				\onslide<1->{\item We could argue that in many cases $S \not\perp G | I$}
				\vspace{0.1in}
				\onslide<2->{\item For example, a student might be intelligent, but we also have to factor in his/her ability to write in time bound exams}
				\vspace{0.1in}
				\onslide<3->{\item In which case $S$ and $G$ are not independent given $I$ (because the SAT score tells us about the ability to write time bound exams)}
				\vspace{0.1in}
				\onslide<4->{\item But, for this discussion, we will assume $S \perp G|I$}
			\end{itemize}
		\end{overlayarea}
	\end{columns}
\end{frame}

% \begin{frame}
% 	\begin{columns}
% 		\column{0.5\textwidth}
% 		\begin{overlayarea}{\textwidth}{\textheight}
% 			\vspace{0.2in}
% 			\begin{center}
% 				\begin{tikzpicture}
% 				    \node[hidden_neuron] at (0,4) {Intelligence};
% 				    \node[hidden_neuron] at (2,2.5) {Grade};
% 				    \node[hidden_neuron] at (-2,2.5) {SAT};
% 				\end{tikzpicture}
% 			\end{center}
% 		\end{overlayarea}
% 		\column{0.5\textwidth}
% 		\begin{overlayarea}{\textwidth}{\textheight}
% 			\begin{itemize}\justifying
% 				\onslide<1->{\item We could argue that in many cases $S \not\perp G | I$}
% 				\vspace{0.1in}
% 				\onslide<2->{\item For example, a student might be intelligent, but we also have to factor in his/her ability to write in time bound exams}
% 				\vspace{0.1in}
% 				\onslide<3->{\item In which case $S$ and $G$ are not independent given $I$}
% 				\vspace{0.1in}
% 				\onslide<4->{\item But, for this discussion, we will assume $S \perp G|I$}
% 			\end{itemize}
% 		\end{overlayarea}
% 	\end{columns}
% \end{frame}

\begin{frame}
			\begin{block}{Question}
				\begin{itemize}\justifying
					\onslide<1->{\item Now let's see the implication of this assumption}
					\onslide<2->{\item Does it simplify things in any way?}
				\end{itemize}
			\end{block}
\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			% \begin{center}
				\onslide<3->{\onslide<8->{\begin{tabular}{ |p{2cm}|p{1cm}|p{1cm}| }
													\hline                                                                  
												                                     
													     & $i=0$ & $i=1$\\                                
													\hline                                          	
													$P(I)$ & 0.7 & 0.3\\                                
													
													\hline                                      
													                                              
												\end{tabular}}
								\newline
								\onslide<9->{\textcolor{blue}{no.of parameters=1}}
								\newline
								\newline
								\onslide<10->{\begin{tabular}{ |p{2cm}|p{1cm}|p{1cm}| }
																	\hline
																	 & s=0 & s=1\\ 
																	 \hline
																	  $P(S|I=0)$ & 0.95 & 0.05\\
																	   \hline
																	    $P(S|I=1)$ & 0.2 & 0.8\\
																	 	\hline
																\end{tabular}}
								\newline
								\onslide<11->{\textcolor{blue}{no.of parameters=2}}
								\newline
								\newline
								\onslide<12->{\begin{tabular}{ |p{2cm}|p{1cm}|p{1cm}| p{1cm}|}
																	\hline
																	 & g=A & g=B & g=C\\ 
																	 \hline
																	  P(G|I=0) & 0.2 & 0.34 & 0.46\\
																	   \hline
																	    P(G|I=1) & 0.74 & 0.17 & 0.09\\
																	 	\hline
																\end{tabular}}
								\onslide<13->{\textcolor{blue}{no.of parameters=4}}
								\newline
								\newline
								\onslide<14->{\textbf{\textcolor{blue}{total no.of parameters=7}}}}
			% \end{center}
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\begin{itemize}\justifying
				\onslide<1->{\item How many parameters do we need to specify $P(I,G,S)$?
							\begin{align*}
								(2\times 2 \times 3 - 1 = 11)
							\end{align*}}
				\onslide<2->{\item What if we use conditional parameterization by following the chain rule?
								\begin{align*}
									\onslide<3->{P(I,G,S) &= P(S,G|I)P(I)} \\
									\onslide<4->{&= P(S|G,I)P(G|I)P(I)} \\
									\onslide<5->{&= P(S|I)P(G|I)P(I)}
								\end{align*}
								\onslide<6->{since $(S\perp G|I)$}}
				\onslide<7->{\item We need the following distributions to fully specify the joint distribution}
			\end{itemize}
		\end{overlayarea}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			% \begin{center}
				\begin{tabular}{ |p{2cm}|p{1cm}|p{1cm}| }
					\hline                                                                  
				                                     
					     & $i=0$ & $i=1$\\                                
					\hline                                          	
					$P(I)$ & 0.7 & 0.3\\                                
					
					\hline                                      
					                                              
				\end{tabular}
				\newline
				\textcolor{blue}{no.of parameters=1}
				\newline
				\newline
				\begin{tabular}{ |p{2cm}|p{1cm}|p{1cm}| }
					\hline
					 & s=0 & s=1\\ 
					 \hline
					  $P(S|I=0)$ & 0.95 & 0.05\\
					   \hline
					    $P(S|I=1)$ & 0.2 & 0.8\\
					 	\hline
				\end{tabular}
				\newline
				\textcolor{blue}{no.of parameters=2}
				\newline
				\newline
				\begin{tabular}{ |p{2cm}|p{1cm}|p{1cm}| p{1cm}|}
					\hline
					 & g=A & g=B & g=C\\ 
					 \hline
					  P(G|I=0) & 0.2 & 0.34 & 0.46\\
					   \hline
					    P(G|I=1) & 0.74 & 0.17 & 0.09\\
					 	\hline
				\end{tabular}
				\textcolor{blue}{no.of parameters=4}
				\newline
				\newline
				\textbf{\textcolor{blue}{total no.of parameters=7}}
			% \end{center}
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\begin{itemize}\justifying
				\onslide<1->{\item The alternate parameterization is more \textbf{natural} than that of the joint distribution}
				\vspace{0.1in}
				\onslide<2->{\item The alternate parameterization is more \textbf{compact} than that of the joint distribution}
				\vspace{0.1in}
				\onslide<3->{\item The alternate parameterization is more \textbf{modular}. (When we added $G$, we could just reuse the tables for $P(I)$ and $P(S|I)$)}
			\end{itemize}
		\end{overlayarea}
	\end{columns}
\end{frame}
