\begin{frame}
	\myheading{Module 19.4: Can we use a graph to represent a joint distribution?}
\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\begin{center}
				\includegraphics[scale=0.35]{images/image5_sharelatex}
			\end{center}
			\vspace{-2em}
	       \begin{itemize}
		    	\onslide<1->{\item This is called the Naive Bayes model}
		       	\onslide<2->{\item It makes the Naive assumption that $^nC_2$ pairs are independent given C}
	       \end{itemize}
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\begin{itemize}
				\onslide<1->{\item Suppose we have $n$ random variables, all of which are independent given another random variable $C$.}
				\onslide<2->{\item The joint distribution factorizes as,
								\begin{align*}
									P(C,X_{1},...,X_{n}) &= P(C)P(X_{1}|C) \\
									& P(X_{2}|X_{1},C) \\
									& P(X_{3}|X_{2},X_{1},C) ... \\
									&= P(C)\prod_{i=1}^{n}P(X_{i}|C)
								\end{align*}
								since $X_{i} \perp X_{j} | C$
							}
			\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}
				\includegraphics[scale=0.35]{images/image6_sharelatex}
			\end{center}
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\begin{itemize}
				\onslide<1->{\item Bayesian networks build on the intuitions that we developed for the Naive Bayes model.}
				\onslide<2->{\item But they are not restricted to strong (naive) independence assumptions}
				\onslide<3->{\item We use graphs to represent the joint probability.}
				\onslide<4->{\item \textbf{Nodes:} Random Variables}
				\onslide<5->{\item \textbf{Edges:} Indicate dependence}
			\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}
				\includegraphics[scale=0.35]{images/image7_sharelatex}
			\end{center}
			\vspace{-3em}
			\begin{itemize}
				\onslide<1->{\item The grade now depends on student's Intelligence \& exam's Difficulty level}
				\onslide<2->{\item The score depends on Intelligence}
				\onslide<3->{\item The recommendation Letter from the course instructor depends on Grade}
			\end{itemize}
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\begin{itemize}
				\onslide<1->{\item Let's revisit the student example.}
				\onslide<2->{\item We will introduce a few more random variables and independence assumptions.}
			\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}
				\includegraphics[scale=0.35]{images/image7_sharelatex}
			\end{center}
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\begin{itemize}
				\onslide<1->{\item The Bayesian network contains a node for each random variable.}
				\onslide<2->{\item The edges denote the dependencies between the random variables.}
				\onslide<3->{\item Each variable depends directly on its parents in the network.}
			\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}
				\includegraphics[scale=0.35]{images/image7_sharelatex}
			\end{center}
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\begin{itemize}
				\onslide<1->{\item The Bayesian network can be viewed as a data structure.}
				\onslide<2->{\item It provides a skeleton for representing a joint distribution compactly by factorization}
				\onslide<3->{\item Let us see what this means.}
			\end{itemize}
		\end{overlayarea}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\begin{itemize}
				\onslide<1->{\item Each node is associated with a local probability model.}
				\onslide<2->{\item Local, because it represents the dependencies of each variable on its parents}
				\onslide<3->{\item There are 5 such local probability models associated with the graph.}
				\onslide<4->{\item Each variable (in general) is associated with a conditional probability distribution (conditional on its parents).}
			\end{itemize}
		\end{overlayarea}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			
		\end{overlayarea}
		\column{0.5\textwidth}
		\begin{overlayarea}{\textwidth}{\textheight}
			\vspace{0.2in}
			\begin{itemize}
				\onslide<1->{\item The graph gives us a natural factorization for the joint distribution.}
				\onslide<2->{\item In this case,
								\begin{align*}
									P(I,D,G,S,L) = P(I)P(D)\\
													P(G|I,D)\\
													P(S|I)P(L|G)
								\end{align*}}
				\onslide<3->{\item For example,
								\begin{align*}
									P(I=1,D=0,G=B,S=1,L=0) \\
									=0.3 \times 0.6 \times 0.8 \times 0.8 \times 0.4
								\end{align*}}
				\onslide<4->{\item The graph structure (nodes, edges) along with a conditional probability distribution is called Bayesian Network}
			\end{itemize}
		\end{overlayarea}
	\end{columns}
\end{frame}
