\begin{frame}
	\myheading{Module 20.3 : Setting up a Markov Chain for RBMs}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
	\begin{columns}

		\begin{column}{0.4\textwidth}
		\renewcommand{\arraystretch}{1.5}
		\begin{table}[]
			\centering
			\scalebox{0.65}
			{
				\begin{tabular}{l c c c c c c c c}

					              & $V_1$ & $V_2$ & $ \dots$ & $V_m$  & $H_1$ & $H_2$ & $ \dots$ & $H_n$\\
					 & $X_1$ & $X_2$ & $X_3$ &   & $\dots$ & $\dots$ &  & $X_{n+m}$ \\
					\onslide<2->{0} & \onslide<2->{1} & \onslide<2->{1} & \onslide<2->{0} &   & \onslide<2->{$\dots$} & \onslide<2->{$\dots$} &  & \onslide<2->{1} \\
					\onslide<2->{1} & \onslide<3->{1} & \onslide<3->{\textcolor{blue}{0}} & \onslide<3->{0} &   & \onslide<3->{$\dots$} & \onslide<3->{$\dots$} &  & \onslide<3->{1} \\
					\onslide<2->{2} &  &  &  &   &  &  &  & \\
				\end{tabular}
			}

		\end{table}
		\end{column}
		\begin{column}{0.6\textwidth}


			\begin{itemize}
				\justifying
				\item<1-> We begin by defining our Markov Chain
				\item<2-> Recall that $X = \{V,H\} \in \{0, 1\}^{n+m}$, so at time step 0 we create a random vector $X \in \{0, 1\}^{n+m}$
				\item<3-> At time-step 1, we transition to a new value of $X$
				\item<4-> What does this mean? How do we do this transition? Let us see
			\end{itemize}
		\end{column}
	\end{columns}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
	\begin{columns}

		\begin{column}{0.4\textwidth}
			\renewcommand{\arraystretch}{1.5}
			\begin{table}[]
				\centering
				\scalebox{0.65}
				{
					\begin{tabular}{l c c c c c c c c}

              & $V_1$ & $V_2$ & $ \dots$ & $V_m$  & $H_1$ & $H_2$ & $ \dots$ & $H_n$\\
				 & $X_1$ & $X_2$ & $X_3$ &   & $\dots$ & $\dots$ &  & $X_{n+m}$ \\
						\onslide<1->{0} & \onslide<1->{1} & \onslide<1->{\alert<4->{1}} & \onslide<1->{0} &   & \onslide<1->{$\dots$} & \onslide<1->{$\dots$} &  & \onslide<1->{1} \\
						\onslide<1->{1} & \onslide<5->{1} & \onslide<5->{\textcolor{blue}{0}} & \onslide<5->{\alert<6->{0}} &   & \onslide<5->{$\dots$} & \onslide<5->{$\dots$} &  & \onslide<5->{1} \\
						\onslide<1->{2} & \onslide<7->{\alert<8->{1}} & \onslide<7->{0} & \onslide<7->{\textcolor{blue}{1}} &   & \onslide<7->{$\dots$} & \onslide<7->{$\dots$} &  & \onslide<7->{1} \\
						\onslide<1->{3} & \onslide<9->{\textcolor{blue}{1}} & \onslide<9->{0} & \onslide<9->{1} &   & \onslide<9->{$\dots$} & \onslide<9->{$\dots$} &  & \onslide<9->{\alert<10->{1}} \\
						\onslide<1->{4} & \onslide<11->{1} & \onslide<11->{0} & \onslide<11->{1} &   & \onslide<11->{$\dots$} & \onslide<11->{$\dots$} &  & \onslide<11->{\textcolor{blue}{0}}\\
						\onslide<12->{$\vdots$} & \onslide<12->{$\vdots$}  &  &  &   &  &  &  & \\
						\onslide<12->{$\vdots$} & \onslide<12->{$\vdots$} &  &  &   &  &  &  & \\
					\end{tabular}
				}

			\end{table}
		\end{column}
		\begin{column}{0.6\textwidth}

			%\textit{Creating the Markov Chain}
			\begin{itemize}
				\justifying
				\item<1-> We need to transition from a state $X = x \in \{0, 1\}^{n+m}$ to $y \in \{0, 1\}^{n+m}$
				\item<2-> This is how we will do it
				\item<3-> Sample a value $i \in \{1$ to $n+m\}$ using a distribution $q(i)$ (say, uniform distribution)
				\item<4-> Fix the value of all variables except $X_i$
				\item<5-> Sample a new value for $X_i$ (could be a V or a H) using the following conditional distribution
					\begin{align*}
						P(X_i = y_i | X_{-i}=x_{-i})
					\end{align*}
				\item<6-> Repeat the above process for many many time steps (each time step corresponds to 1 step of the chain)
			\end{itemize}
		\end{column}
	\end{columns}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
	\begin{columns}

		\begin{column}{0.4\textwidth}
			\renewcommand{\arraystretch}{1.5}
			\begin{table}[]
				\centering
				\scalebox{0.65}
				{
					\begin{tabular}{l c c c c c c c c}

              & $V_1$ & $V_2$ & $ \dots$ & $V_m$  & $H_1$ & $H_2$ & $ \dots$ & $H_n$\\
				 & $X_1$ & $X_2$ & $X_3$ &   & $\dots$ & $\dots$ &  & $X_{n+m}$ \\
						0 & 1 & \alert<1->{1} & 0 &   & $\dots$ & $\dots$ &  & 1 \\
						1 & 1 & \textcolor{blue}{0} & \alert<1->{0} &   & $\dots$ & $\dots$ &  & 1 \\
						2 & \alert<1->{1} & 0 & \textcolor{blue}{1} &   & $\dots$ & $\dots$ &  & 1 \\
						3 & \textcolor{blue}{1} & 0 & 1 &   & $\dots$ & $\dots$ &  & \alert<1->{1} \\
						4 & 1 & 0 & 1 &   & $\dots$ & $\dots$ &  & \textcolor{blue}{0}\\
						$\vdots$ & $\vdots$  &  &  &   &  &  &  & \\
						$\vdots$ & $\vdots$ &  &  &   &  &  &  & \\
					\end{tabular}
				}

			\end{table}
		\end{column}
		\begin{column}{0.6\textwidth}

			\begin{itemize}
				\justifying
				\item<1-> What are we doing here? How is this related to our goals?
				\item<2-> More specifically, we have defined a Markov Chain, but where is our Transition Matrix T?
				\item<3-> How is it easy to create this chain (or creating samples $x_0, x_1, ... x_N$) ?
				\item<4-> How do we show that the stationary distribution is $P(X)$ (where $X = {V, H}$) [We haven't even defined $T$, then how can we talk about the stationary distribution for $T$] ?
				\item<5-> Let us answer these questions one by one
			\end{itemize}
		\end{column}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}

		\begin{column}{0.4\textwidth}
			\renewcommand{\arraystretch}{1.5}
			\begin{table}[]
				\centering
				\scalebox{0.65}
				{
					\begin{tabular}{l c c c c c c c c}

              & $V_1$ & $V_2$ & $ \dots$ & $V_m$  & $H_1$ & $H_2$ & $ \dots$ & $H_n$\\
				 & $X_1$ & $X_2$ & $X_3$ &   & $\dots$ & $\dots$ &  & $X_{n+m}$ \\
						0 & 1 & \alert<1->{1} & 0 &   & $\dots$ & $\dots$ &  & 1 \\
						1 & 1 & \textcolor{blue}{0} & \alert<1->{0} &   & $\dots$ & $\dots$ &  & 1 \\
						2 & \alert<1->{1} & 0 & \textcolor{blue}{1} &   & $\dots$ & $\dots$ &  & 1 \\
						3 & \textcolor{blue}{1} & 0 & 1 &   & $\dots$ & $\dots$ &  & \alert<1->{1} \\
						4 & 1 & 0 & 1 &   & $\dots$ & $\dots$ &  & \textcolor{blue}{0}\\
						$\vdots$ & $\vdots$  &  &  &   &  &  &  & \\
						$\vdots$ & $\vdots$ &  &  &   &  &  &  & \\
					\end{tabular}
				}

			\end{table}
		\end{column}
		\begin{column}{0.6\textwidth}

			\begin{itemize}
				\justifying
				\item<1-> First, let us talk about the transition matrix
				\item<2-> We have actually defined $T$ although we did not explicitly mention it
				\item<3-> What would $T$ contain ? \onslide<4->{The probability of transitioning from any state $x$ to any state $y$}
				\item<5-> So $T \in R^{2^{m+n} \times 2^{m+n}}$ \onslide<6->{(when did we define such a matrix?)}
				\item<7-> Actually, we defined a very simple $T$ which allowed only certain types of transitions
				\item<8-> In particular, under this $T$, transitioning from a state $x$ to a state $y$ was possible only if $x$ and $y$ differ in the value of only one of the $n+m$ variables
			\end{itemize}
		\end{column}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}

		\begin{column}{0\textwidth}
			\begin{overlayarea}{\textwidth}{\textheight}
				\centering
				\vspace{0.5cm}
				% \begin{figure}
				% 	\includegraphics[scale=0.4]{images/noisy_image.jpg}
				% 	\caption{$X\in R^{1024}$}
				% \end{figure}
				% \vspace{1.5cm}
				% \begin{align*}
				% 	\mathbb{E}_{P(X)}[f(X)]
				% \end{align*}

			\end{overlayarea}
		\end{column}
		\begin{column}{1.0\textwidth}

			\begin{itemize}
				\justifying
				\item<1-> More formally, we defined $T$ such that
							\onslide<2->{\small{\[
																					p_{\mathbf{x}\mathbf{y}} =
																						\begin{cases}
																                            q(i)P(y_{i}|x_{-i}), \text{ if } \exists i \in \mathbf{X} \text{ so that } \forall v \in \mathbf{X} \text{ with } v \neq i, x_{v} = y_{v} \\
																                            0, \text{ otherwise }
																                        \end{cases}
																					\]}}
				\item<3-> where $q(i)$ is the probability that $X_i$ is the random variable whose value transitions while the value of $X_{-i}$ remains the same
				\item<4-> The second term $P(X_i = y_i | \mathbf{X}_{-i})$ essentially tells us that given the value of the remaining random variable what is the probability of $X_i$ taking on a certain value
				\item<5-> With that we have answered the first question ``What is the transition matrix $T$?" (It is a very sparse matrix allowing only certain transitions)
			\end{itemize}
		\end{column}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}

		\begin{column}{0.4\textwidth}
			\renewcommand{\arraystretch}{1.5}
			\begin{table}[]
				\centering
				\scalebox{0.65}
				{
					\begin{tabular}{l c c c c c c c c}

              & $V_1$ & $V_2$ & $ \dots$ & $V_m$  & $H_1$ & $H_2$ & $ \dots$ & $H_n$\\
				 & $X_1$ & $X_2$ & $X_3$ &   & $\dots$ & $\dots$ &  & $X_{n+m}$ \\
						0 & 1 & \alert<1->{1} & 0 &   & $\dots$ & $\dots$ &  & 1 \\
						1 & 1 & \textcolor{blue}{0} & \alert<1->{0} &   & $\dots$ & $\dots$ &  & 1 \\
						2 & \alert<1->{1} & 0 & \textcolor{blue}{1} &   & $\dots$ & $\dots$ &  & 1 \\
						3 & \textcolor{blue}{1} & 0 & 1 &   & $\dots$ & $\dots$ &  & \alert<1->{1} \\
						4 & 1 & 0 & 1 &   & $\dots$ & $\dots$ &  & \textcolor{blue}{0}\\
						$\vdots$ & $\vdots$  &  &  &   &  &  &  & \\
						$\vdots$ & $\vdots$ &  &  &   &  &  &  & \\
					\end{tabular}
				}

			\end{table}
		\end{column}
		\begin{column}{0.6\textwidth}

			\begin{itemize}
				\justifying
				\item<1-> We now look at the second question : \onslide<2->{How is it easy to create this chain (or creating samples $x_0, x_1, ... x_l$)?}
				\item<3-> At each step we are changing only one of the $n+m$ random variables using the following probability
 \onslide<4->{\[P(X_i = y_i | X_{-i}=x_{-i}) = \frac{P(X)}{P(X_{-i})}\]}
				\item<5-> But how is computing this probability easy? Doesn't the joint distribution on LHS also have $2^{n+m}$ parameters ?
				\item<6-> Well, not really !
			\end{itemize}
		\end{column}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}

		\begin{column}{0.4\textwidth}
			\renewcommand{\arraystretch}{1.5}
			\begin{table}[]
				\centering
				\scalebox{0.65}
				{
					\begin{tabular}{l c c c c c c c c}

              & $V_1$ & $V_2$ & $ \dots$ & $V_m$  & $H_1$ & $H_2$ & $ \dots$ & $H_n$\\
				 & $X_1$ & $X_2$ & $X_3$ &   & $\dots$ & $\dots$ &  & $X_{n+m}$ \\
						0 & 1 & \alert<1->{1} & 0 &   & $\dots$ & $\dots$ &  & 1 \\
						1 & 1 & \textcolor{blue}{0} & \alert<1->{0} &   & $\dots$ & $\dots$ &  & 1 \\
						2 & \alert<1->{1} & 0 & \textcolor{blue}{1} &   & $\dots$ & $\dots$ &  & 1 \\
						3 & \textcolor{blue}{1} & 0 & 1 &   & $\dots$ & $\dots$ &  & \alert<1->{1} \\
						4 & 1 & 0 & 1 &   & $\dots$ & $\dots$ &  & \textcolor{blue}{0}\\
						$\vdots$ & $\vdots$  &  &  &   &  &  &  & \\
						$\vdots$ & $\vdots$ &  &  &   &  &  &  & \\
					\end{tabular}
				}

			\end{table}
		\end{column}
		\begin{column}{0.6\textwidth}

			\begin{itemize}
				\justifying
				\item<1-> Consider the case when $i <= m$ (i.e., we have decided to transition the value of one of the visible variables $V_1$ to $V_m$)
				\item<2-> Then $P(X_i = y_i | X_{-i}=x_{-i})$ is essentially
						\onslide<3->{
							\begin{align*}
								P(V_i = y_i | V_{-i}, H) &= P(V_i = y_i | H)
								&= \begin{cases}
										z, \text{if } y_{i} = 1 \\
										1 - z, \text{if } y_{i} = 0
									\end{cases}
							\end{align*}
						}
						\onslide<4->{where $z = \sigma(\sum_{j=1}^{m}w_{ij}v_j + c_i)$}
				\item<4-> The above probability is very easy to compute (just a sigmoid function)
				\item<5-> Once you compute the above probability, with probability $z$ you will set the value of $V_i$ to $1$ and with probability $1-z$ you will set it to $0$
			\end{itemize}
		\end{column}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}

		\begin{column}{0.4\textwidth}
			\renewcommand{\arraystretch}{1.5}
			\begin{table}[]
				\centering
				\scalebox{0.65}
				{
					\begin{tabular}{l c c c c c c c c}

              & $V_1$ & $V_2$ & $ \dots$ & $V_m$  & $H_1$ & $H_2$ & $ \dots$ & $H_n$\\
				 & $X_1$ & $X_2$ & $X_3$ &   & $\dots$ & $\dots$ &  & $X_{n+m}$ \\
						0 & 1 & \alert<1->{1} & 0 &   & $\dots$ & $\dots$ &  & 1 \\
						1 & 1 & \textcolor{blue}{0} & \alert<1->{0} &   & $\dots$ & $\dots$ &  & 1 \\
						2 & \alert<1->{1} & 0 & \textcolor{blue}{1} &   & $\dots$ & $\dots$ &  & 1 \\
						3 & \textcolor{blue}{1} & 0 & 1 &   & $\dots$ & $\dots$ &  & \alert<1->{1} \\
						4 & 1 & 0 & 1 &   & $\dots$ & $\dots$ &  & \textcolor{blue}{0}\\
						$\vdots$ & $\vdots$  &  &  &   &  &  &  & \\
						$\vdots$ & $\vdots$ &  &  &   &  &  &  & \\
					\end{tabular}
				}

			\end{table}
		\end{column}
		\begin{column}{0.6\textwidth}

			\begin{itemize}
				\justifying
				\item<1-> So essentially at every time step you sample a $i$ from a uniform distribution ($q_i$)
				\item<2-> And then sample a value of $V_i \in \{0,1\}$ using the distribution $Bernoulli(z)$
				\item<3-> Both these computations are easy
				\item<4-> Hence it is easy to create this chain starting from any $x_0$
			\end{itemize}
		\end{column}
	\end{columns}
\end{frame}

\begin{frame}
	% \begin{columns}

		% \begin{column}{0.4\textwidth}
		% 	\renewcommand{\arraystretch}{1.5}
		% 	\begin{table}[]
		% 		\centering
		% 		\scalebox{0.65}
		% 		{
		% 			\begin{tabular}{l c c c c c c c c}

  %             & $V_1$ & $V_2$ & $ \dots$ & $V_m$  & $H_1$ & $H_2$ & $ \dots$ & $H_n$\\
		% 		 & $X_1$ & $X_2$ & $X_3$ &   & $\dots$ & $\dots$ &  & $X_{n+m}$ \\
		% 				\onslide<1->{0} & \onslide<1->{0.05} & \onslide<1->{\alert<4->{0.02}} & \onslide<1->{0.03} &   & \onslide<1->{$\dots$} & \onslide<1->{$\dots$} &  & \onslide<1->{0.08} \\
		% 				\onslide<1->{1} & \onslide<5->{0.05} & \onslide<5->{0.04} & \onslide<5->{\alert<6->{0.03}} &   & \onslide<5->{$\dots$} & \onslide<5->{$\dots$} &  & \onslide<5->{0.08} \\
		% 				\onslide<1->{2} & \onslide<7->{0.05} & \onslide<7->{0.04} & \onslide<7->{0.06} &   & \onslide<7->{$\dots$} & \onslide<7->{$\dots$} &  & \onslide<7->{0.08} \\
		% 			\end{tabular}
		% 		}
		% 	\end{table}
		% \end{column}
		% \begin{column}{0.6\textwidth}

	\begin{itemize}
		\justifying
		\item<1-> Okay, finally let's look at the third question: How do we show that the stationary distribution is $P(X)$ (where $X = {V, H}$)
		\item<2-> To prove this we will refer to the following Theorem:\\
					\onslide<3->{
					\begin{block}{Detailed Balance Condition}
				% 	A sufficient (but not necessary) condition for a distribution $\pi$ to be stationary w.r.t a Markov Chain described by the transition probabilities $p_{xy}, x,y \in \Omega$ is that $\forall x,y \in \Omega$, it holds that $\pi(x)p_{xy} = \pi(x)p_{yx}$
				        To show that a distribution $\pi$ is a stationary distribution for a Markov Chain described by the transition probabilities $p_{xy}$, $x,y\in \Omega$, it is sufficient to show that $\forall x,y \in \Omega$, the following condition holds: \\
				            \[\pi(x)p_{xy} = \pi(x)p_{yx}\]
					\end{block}
					}
		\item<4-> Let us revisit what $p_{xy}$ is and what $\pi$ is
	\end{itemize}
		% \end{column}
	% \end{columns}
\end{frame}

\begin{frame}
	\begin{columns}

		\begin{column}{0.0\textwidth}
			\begin{overlayarea}{\textwidth}{\textheight}
				\centering
				\vspace{0.5cm}
				% \begin{figure}
				% 	\includegraphics[scale=0.4]{images/noisy_image.jpg}
				% 	\caption{$X\in R^{1024}$}
				% \end{figure}
				% \vspace{1.5cm}
				% \begin{align*}
				% 	\mathbb{E}_{P(X)}[f(X)]
				% \end{align*}

			\end{overlayarea}
		\end{column}
		\begin{column}{1.0\textwidth}

			\begin{itemize}
				\justifying
				\item<1-> Recall that $p_{\bm{xy}}$ is given by
					\onslide<2->{\small{\[
																					p_{\mathbf{x}\mathbf{y}} =
																						\begin{cases}
																                            q(i)P({X}_{i}=y_{i}|\mathbf{X}_{-i}\bm{x}_{-i}), \text{ if } \exists i \in \{1,2,\dots,n+m\} \text{ such that } \forall j \in \{1,2,\dots,n+m\} \text{if } j \neq i, x_{j} = y_{j} \\
																                            0, \text{ otherwise }
																                        \end{cases}
																					\]}}
				\item<3-> For consistency of notation we will denote $P(X)$ i.e., $P(V,H)$ as $\pi(X)$
				\item<4-> Further, as shorthand we will refer to $\pi(X=\bm{x})$ as $\pi(\bm{x})$
				\item<5-> Thus, to prove that $P(X)$, i.e., $\pi(X)$ is the stationary distribution for our Markov Chain we need to prove that
						\[\pi(\bm{x})p_{\bm{xy}} = \pi(\bm{y})p_{\bm{yx}}~~~ \forall \bm{x},\bm{y} \in \{0,1\}^{m+n}\]
			\end{itemize}
		\end{column}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}

		\begin{column}{0.4\textwidth}
			\renewcommand{\arraystretch}{1.5}
			\textbf{To prove:} $\pi(\bm{x})p_{\bm{xy}} =\pi(\bm{y})p_{\bm{yx}} $
			\begin{table}[]
				\centering
				\scalebox{0.65}
				{
					\begin{tabular}{l c c c c c c c c}

              & $V_1$ & $V_2$ & $ \dots$ & $V_m$  & $H_1$ & $H_2$ & $ \dots$ & $H_n$\\
				 & $X_1$ & $X_2$ & $X_3$ &   & $\dots$ & $\dots$ &  & $X_{n+m}$ \\
						0 & 1 & \alert<1->{1} & 0 &   & $\dots$ & $\dots$ &  & 1 \\
						1 & 1 & \textcolor{blue}{0} & \alert<1->{0} &   & $\dots$ & $\dots$ &  & 1 \\
						2 & \alert<1->{1} & 0 & \textcolor{blue}{1} &   & $\dots$ & $\dots$ &  & 1 \\
						3 & \textcolor{blue}{1} & 0 & 1 &   & $\dots$ & $\dots$ &  & \alert<1->{1} \\
						4 & 1 & 0 & 1 &   & $\dots$ & $\dots$ &  & \textcolor{blue}{0}\\
						$\vdots$ & $\vdots$  &  &  &   &  &  &  & \\
						$\vdots$ & $\vdots$ &  &  &   &  &  &  & \\
					\end{tabular}
				}

			\end{table}
		\end{column}
		\begin{column}{0.6\textwidth}

			\begin{itemize}
				\justifying
				\item<1-> There are 3 cases that we need to consider
				\item<2-> \textbf{Case 1:} \onslide<3->{$\bm{x}$ and $\bm{y}$ differ in the state of more than one random variable}
				\item<4-> In this case, by definition
						\onslide<5->{
							\begin{align*}
								\pi(\bm{x})p_{\bm{xy}} = \pi(\bm{x}) * 0 = 0 \\
								\pi(\bm{y})p_{\bm{yx}} = \pi(\bm{y}) * 0 = 0
							\end{align*}
						}
				\item<6-> Hence the detailed balance condition holds trivially
			\end{itemize}
		\end{column}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}

		\begin{column}{0.4\textwidth}
			\renewcommand{\arraystretch}{1.5}
			\textbf{To prove:} $\pi(\bm{x})p_{\bm{xy}} =\pi(\bm{y})p_{\bm{yx}} $
			\begin{table}[]
				\centering
				\scalebox{0.65}
				{
					\begin{tabular}{l c c c c c c c c}

              & $V_1$ & $V_2$ & $ \dots$ & $V_m$  & $H_1$ & $H_2$ & $ \dots$ & $H_n$\\
				 & $X_1$ & $X_2$ & $X_3$ &   & $\dots$ & $\dots$ &  & $X_{n+m}$ \\
						0 & 1 & \alert<1->{1} & 0 &   & $\dots$ & $\dots$ &  & 1 \\
						1 & 1 & \textcolor{blue}{0} & \alert<1->{0} &   & $\dots$ & $\dots$ &  & 1 \\
						2 & \alert<1->{1} & 0 & \textcolor{blue}{1} &   & $\dots$ & $\dots$ &  & 1 \\
						3 & \textcolor{blue}{1} & 0 & 1 &   & $\dots$ & $\dots$ &  & \alert<1->{1} \\
						4 & 1 & 0 & 1 &   & $\dots$ & $\dots$ &  & \textcolor{blue}{0}\\
						$\vdots$ & $\vdots$  &  &  &   &  &  &  & \\
						$\vdots$ & $\vdots$ &  &  &   &  &  &  & \\
					\end{tabular}
				}

			\end{table}
		\end{column}
		\begin{column}{0.6\textwidth}

			\begin{itemize}
				\justifying
				\item<1-> There are 3 cases that we need to consider
				\item<2-> \textbf{Case 2:} \onslide<3->{$\bm{x}$ and $\bm{y}$ are equal (i.e., they do not differ in the state of any random variable)}
				\item<4-> In this case, by definition
						\onslide<5->{
							\begin{align*}
								\pi(\bm{x})p_{\bm{xy}} = \pi(\bm{x})p_{\bm{xx}} \\
								\pi(\bm{y})p_{\bm{yx}} = \pi(\bm{x})p_{\bm{xx}}
							\end{align*}
						}
				\item<6-> Hence the detailed balance condition holds trivially
			\end{itemize}
		\end{column}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}

		\begin{column}{0.4\textwidth}
			\renewcommand{\arraystretch}{1.5}
			\textbf{To prove:} $\pi(\bm{x})p_{\bm{xy}} =\pi(\bm{y})p_{\bm{yx}} $
			\begin{table}[]
				\centering
				\scalebox{0.65}
				{
					\begin{tabular}{l c c c c c c c c}

              & $V_1$ & $V_2$ & $ \dots$ & $V_m$  & $H_1$ & $H_2$ & $ \dots$ & $H_n$\\
				 & $X_1$ & $X_2$ & $X_3$ &   & $\dots$ & $\dots$ &  & $X_{n+m}$ \\
						0 & 1 & \alert<1->{1} & 0 &   & $\dots$ & $\dots$ &  & 1 \\
						1 & 1 & \textcolor{blue}{0} & \alert<1->{0} &   & $\dots$ & $\dots$ &  & 1 \\
						2 & \alert<1->{1} & 0 & \textcolor{blue}{1} &   & $\dots$ & $\dots$ &  & 1 \\
						3 & \textcolor{blue}{1} & 0 & 1 &   & $\dots$ & $\dots$ &  & \alert<1->{1} \\
						4 & 1 & 0 & 1 &   & $\dots$ & $\dots$ &  & \textcolor{blue}{0}\\
						$\vdots$ & $\vdots$  &  &  &   &  &  &  & \\
						$\vdots$ & $\vdots$ &  &  &   &  &  &  & \\
					\end{tabular}
				}

			\end{table}
		\end{column}
		\begin{column}{0.6\textwidth}

			\begin{itemize}
				\justifying
				\item<1-> There are 3 cases that we need to consider
				\item<2-> \textbf{Case 3:} \onslide<3->{$\bm{x}$ and $\bm{y}$ differ in the state of only one random variable}
				\item<4-> In this case, by definition
						\onslide<5->{
							\begin{align*}
								\onslide<5->{\pi(\bm{x})p_{\bm{xy}} &= \pi(\bm{x})q(i)\pi(y_i|\bm{x}_{-i})} \\
								\onslide<6->{&= q(i)\pi(x_i,\bm{x}_{-i})\frac{\pi(y_i,\bm{x}_{-i})}{\pi(\bm{x}_{-i})}} \\
								\onslide<7->{&= \pi(y_i,\bm{x}_{-i})q(i)\frac{\pi(x_i,\bm{x}_{-i})}{\pi(\bm{x}_{-i})}} \\
								\onslide<8->{&= \pi(\bm{y})q(i)\pi(x_i|x_{-i})} \\
								\onslide<9->{&= \pi(\bm{y})p_{\bm{yx}}}
							\end{align*}
						}
				\vspace{-0.5cm}
				\item<10-> Hence the detailed balance condition holds
			\end{itemize}
		\end{column}
	\end{columns}
\end{frame}

\begin{frame}
	\begin{columns}

		\begin{column}{0.4\textwidth}
			\renewcommand{\arraystretch}{1.5}
			\textbf{To prove:} $\pi(\bm{x})p_{\bm{xy}} =\pi(\bm{y})p_{\bm{yx}} $
			\begin{table}[]
				\centering
				\scalebox{0.65}
				{
					\begin{tabular}{l c c c c c c c c}

              & $V_1$ & $V_2$ & $ \dots$ & $V_m$  & $H_1$ & $H_2$ & $ \dots$ & $H_n$\\
				 & $X_1$ & $X_2$ & $X_3$ &   & $\dots$ & $\dots$ &  & $X_{n+m}$ \\
						0 & 1 & \alert<1->{1} & 0 &   & $\dots$ & $\dots$ &  & 1 \\
						1 & 1 & \textcolor{blue}{0} & \alert<1->{0} &   & $\dots$ & $\dots$ &  & 1 \\
						2 & \alert<1->{1} & 0 & \textcolor{blue}{1} &   & $\dots$ & $\dots$ &  & 1 \\
						3 & \textcolor{blue}{1} & 0 & 1 &   & $\dots$ & $\dots$ &  & \alert<1->{1} \\
						4 & 1 & 0 & 1 &   & $\dots$ & $\dots$ &  & \textcolor{blue}{0}\\
						$\vdots$ & $\vdots$  &  &  &   &  &  &  & \\
						$\vdots$ & $\vdots$ &  &  &   &  &  &  & \\
					\end{tabular}
				}

			\end{table}
		\end{column}
		\begin{column}{0.6\textwidth}

			\begin{itemize}
				\justifying
				\item<1-> Thus we have proved that the detailed balance condition holds in all the 3 cases
				\item<2-> \textbf{Case 1:} \onslide<3->{$\bm{x}$ and $\bm{y}$ differ in the state of more than one random variable}
				\item<4-> \textbf{Case 2:} \onslide<5->{$\bm{x}$ and $\bm{y}$ are equal (i.e., they do not differ in the state of any random variable)}
				\item<6-> \textbf{Case 3:} \onslide<7->{$\bm{x}$ and $\bm{y}$ differ in the state of only one random variable}
			\end{itemize}
		\end{column}
	\end{columns}
\end{frame}
