\documentclass[11pt]{article}
\usepackage{latexsym}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{epsfig}
\usepackage{pstricks,pst-node}
\usepackage[tight]{subfigure}

\newcommand{\handout}[5]{
  \noindent
  \begin{center}
  \framebox{
    \vbox{
      \hbox to 5.78in { {#1} \hfill #2 }
      \vspace{4mm}
      \hbox to 5.78in { {\Large \hfill #5  \hfill} }
      \vspace{2mm}
      \hbox to 5.78in { {\em #3 \hfill #4} }
    }
  }
  \end{center}
  \vspace*{4mm}
}

\newcommand{\lecture}[5]{\handout{#1}{#2}{#3}{#4}{#5}}

\newtheorem{theorem}{Theorem}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{observation}[theorem]{Observation}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{fact}[theorem]{Fact}
\newtheorem{assumption}[theorem]{Assumption}

% 1-inch margins, from fullpage.sty by H.Partl, Version 2, Dec. 15, 1988.
\topmargin 0pt
\advance \topmargin by -\headheight
\advance \topmargin by -\headsep
\textheight 8.9in
\oddsidemargin 0pt
\evensidemargin \oddsidemargin
\marginparwidth 0.5in
\textwidth 6.5in

\parindent 0in
\parskip 1.5ex
%\renewcommand{\baselinestretch}{1.25}

\begin{document}

\lecture{Statistical Techniques in Robotics (16-831, F08)}{Lecture \#5 (09/09/08)}{Lecturer: Drew Bagnell}{Scribe: Ryan Waliany}{Graphical Models}

\section{Graphical Models}

\subsection{What is graphical model?} Graphical model is a language that can be used to represent uncertain quantities and the relationships between them. Nodes represent random variables and edges represent the links, or causal relationships between these random variables. 

\subsection{Key ideas of graphical models}
\begin{itemize}
\item{\textbf{Communication tool}} that helps to \textit{compactly} express my beliefs of a system.
\item{\textbf{Reasoning tool}} that can be used to \textit{extract} relationships that maybe were not obvious when formulating the problem.
\item{\textbf{Computational framework}} that helps organize how we perform \textit{inference}.
\end{itemize}


\section{Bayes' nets}
\subsection{Introduction}
One of the most common graphical models is called a Bayes' net, also known as: a belief network, directed graphical model, directed independence diagram. In short, a Bayes' net is a directed acyclic graph with nodes representing uncertain quantities. 



\begin{figure}[h]
\begin{center}
\begin{pspicture}(-1,-1)(5,7)
\psset{arrowscale=2}
\rput(2,4){\circlenode{a}{\makebox[1cm]{$A$}}}
\rput(0,2){\circlenode{b}{\makebox[1cm]{$B$}}}
\rput(4,2){\circlenode{c}{\makebox[1cm]{$C$}}}
\rput(6,0){\circlenode{d}{\makebox[1cm]{$D$}}}
\ncline[arrows=->]{a}{b}
\ncline[arrows=->]{a}{c}
\ncline[arrows=->]{b}{c}
\ncline[arrows=->]{c}{d}
\end{pspicture}
\end{center}
\caption{A Bayesian network.}
\label{fig:graph1}
\end{figure}

In Figure \ref{fig:graph1}, we have uncertain quantities A, B, C, and we draw directed arrows between them to represent causal relationships. A bayesian network encodes a joint probability distribution over all the nodes in the graph. In this case, our Bayes' net encodes the joint probability distribution, $P(A,B,C,D)$.

The basic factorization of the probability distribution using the Chain Rule of Probability can be seen in Equation \ref{eq:chainrule}. If no graphical model is specified, this factorization is always true.

\begin{equation}
\label{eq:chainrule}
P(A,B,C,D)=P(A)*P(B|A)*P(C|A,B)*P(D|A,B,C)
\end{equation}

In particular with Figure \ref{fig:graph1}, we can use the causal information contained in the graph to eliminate unnecessary conditional dependencies, see equation \ref{eq:jointdist}.

\begin{equation}
\label{eq:jointdist}
P(A,B,C,D)=P(A)P(B|A)P(C|A,B)P(D|C)
\end{equation}

For an arbitrary Bayes' net with nodes $\in X$ where $X$ is defined as $x_1, x_2, ..., x_n$. We can derive the joint distribution of such a graph, $P(X)$ as the product of each node ($x_i)$ given it's parents ($\pi(x_i)$), see equation \ref{eq:jointdist2}.

\begin{equation}
\label{eq:jointdist2}
P(X)=\prod_{x_i}P(x_i|\pi(x_i))
\end{equation}

Looking back at equation \ref{eq:jointdist}, we can derive that quantity using equation \ref{eq:jointdist2} and \ref{fig:graph1}.

The mental model of what a Bayes' net should be that it is a language for encoding a causal relationship. One should think that A is influencing B and C. 

\subsection{Communication tool}
\begin{figure}[h]
\begin{center}
\begin{pspicture}(-2,-2)(6,4)
\psset{arrowscale=2}
\rput(2,0){\circlenode{a}{\makebox[1.8cm]{$Alarm$}}}
\rput(0,2){\circlenode{b}{\makebox[1.8cm]{$Earthquake$}}}
\rput(4,2){\circlenode{c}{\makebox[1.8cm]{$Burglar$}}}
\ncline[arrows=->]{c}{a}
\ncline[arrows=->]{b}{a}
\end{pspicture}
\end{center}
\caption{A classic example in graphical models.}
\label{fig:graph2}
\end{figure}

In the classical burglar problem seen in Figure \ref{fig:graph2}, you have three states, earthquake, burglar, and burglar alarm. Earthquake and Burglar are events that happen independently. If one of the two things happen, then the burglar alarm goes off. One should think that if either happens, then the burglar alarm should go off, but it doesn't describe the actual relationship but what happens. 

Whenever you write down a Bayes' net, you are thinking of a simplified causal model of the world. This will allow us to infer the probability of such quantities like when there is a burglar. There are many algorithms that will learn Bayes' nets from data, which we will see in this class. If you don't specific a Bayes' net down deliberately you may get a Bayes' net that is doesn't preserve causality. For example, there are many Bayes' net factorization that can represent the same structure in the data. In general, if we have an independent set of variables $x_1,x_2,x_3$, we can always add causal relationships (edges) in a Bayes' net that are not necessarily without perturbing the data incorrectly. However, removing dependencies in a Bayes' net may destruct the validity of a joint distribution. The primary reason to write down a Bayes' net is to represent causality. But it doesn't necessarily have to be causal.

\subsection{Reasoning tool}

Bayes' nets have the ability that you can read from them conditional independence relationships.  What is an example of a representation that can encode the Markov relationship between states?

\begin{figure}[h]
\begin{center}
\begin{pspicture}(-1,-1)(5,1)
\psset{arrowscale=2}
\rput(0,0){\circlenode{a}{\makebox[1cm]{$x_1$}}}
\rput(2,0){\circlenode{b}{\makebox[1cm]{$x_2$}}}
\rput(4,0){\circlenode{c}{\makebox[1cm]{$x_3$}}}
\ncline[arrows=->]{a}{b}
\ncline[arrows=->]{b}{c}
\end{pspicture}
\end{center}
\caption{A Bayesian network that demonstrates the Markov assumption.}
\label{fig:markov}
\end{figure}


If you think of this as the robot location, $x_1$ is causally influenced by $x_0$. You don't necessarily need to know $x_1$ to know $x_3$ given information about $x_2$. The key idea is that we are going to be able to determine conditional independencies by operations on the graph. Conditional independence can be defined as: Given C, A and B are independent of each other. This relationship is explored mathematically in equation \ref{eq:condind}

\begin{equation}
\label{eq:condind}
P(A|B,C)=P(A|C)
\end{equation}


What about the case that A and B are independent? Does that necessarily mean that A and B are conditionally independent? No. 

Let's look at the burglar graph in Figure \ref{fig:graph2} and when we condition on the burglar alarm. If we know that the burglar didn't come, how does that influence the probability of the an earthquake happening. It increases the probability of an earthquake, because we know that a burglar didn't arrive. This phenomena is called the explaining away effect. 

Pretend you can get into CMU because your math GRE's were really good, you wrote a really good paper, or you like bag-pipes and that they were independent events. You may really like bag-pipes. Now, I told you that you got into CMU. If I told you that you really liked bag-pipe music, the probability of you having strong GRE scores may not go up as much. Your GRE math scores may be higher than the normal population because you got into CMU, but they might be lower because part of the reason you may have gotten into CMU was due to liking bag-pipes.


The idea behind reading conditional independencies is that you're trying to find a path between two random variables. 

\begin{figure}[h]
\begin{center}
\begin{pspicture}(-1,-1)(7,5)
\psset{arrowscale=2}
\rput(0,2){\circlenode{a}{\makebox[1cm]{$A$}}}
\rput(2,4){\circlenode{b}{\makebox[1cm]{$B$}}}
\rput(2,0){\circlenode{c}{\makebox[1cm]{$C$}}}
\rput(4,2){\circlenode{d}{\makebox[1cm]{$D$}}}
\rput(6,4){\circlenode{e}{\makebox[1cm]{$E$}}}
\ncline[arrows=->]{a}{b}
\ncline[arrows=->]{a}{c}
\ncline[arrows=->]{c}{d}
\ncline[arrows=->]{b}{d}
\ncline[arrows=->]{d}{e}
\end{pspicture}
\end{center}
\caption{$A$ is $\perp$ to $E$ given $B$ and $C$.}
\label{fig:graph5}
\end{figure}


Let's say that you want to find the relationship between A and E in Figure \ref{fig:graph5}, so there are two paths (this is not just any path, but a directed path). For two things to possibly not be dependent, you need to block all paths to E from A. That is, if there is a path from A to E, A and E are dependent.

For the possibility of dependencies, there must be an \textbf{unblocked} path between the two variables. A and B are said to be dependent on each other if there is an unblocked path. 


There are two rules for blocked path:

\subsubsection{Rule \#1}
Additionally, say you look at a node along a path and there are no converging arrows (see Figure \ref{fig:graph7}),  the path is then blocked. Figure \ref{fig:graph5} and \ref{fig:graph6} show the two cases in which conditional independence is achieved absent of converging arrows. In these graphs, there are no conditional dependence between A and B. 

\begin{figure}[h]
\begin{center}
\begin{pspicture}(-1,-1)(5,1)
\psset{arrowscale=2} 
\rput(0,0){\circlenode{a}{\makebox[1cm]{$A$}}}
\pscircle*[linecolor=cyan](2,0){.6cm}
\rput(2,0){\circlenode{b}{\makebox[1cm]{$B$}}}
\rput(4,0){\circlenode{c}{\makebox[1cm]{$C$}}}
\ncline[arrows=->]{a}{b}
\ncline[arrows=->]{b}{c}
\end{pspicture}
\end{center}
\caption{\textbf{BLOCKED} $A$ is $\perp$ to $C$ given $B$.}
\label{fig:graph5}
\end{figure}


\begin{figure}[h]
\begin{center}
\begin{pspicture}(-1,-1)(5,3)
\psset{arrowscale=2} 
\rput(0,0){\circlenode{a}{\makebox[1cm]{$A$}}}
\pscircle*[linecolor=cyan](2,2){.6cm}
\rput(2,2){\circlenode{b}{\makebox[1cm]{$B$}}}
\rput(4,0){\circlenode{c}{\makebox[1cm]{$C$}}}
\ncline[arrows=->]{b}{a}
\ncline[arrows=->]{b}{c}
\end{pspicture}
\end{center} 
\caption{\textbf{BLOCKED} $A$ is $\perp$ to $C$ given $B$.}
\label{fig:graph6}
\end{figure}


\subsubsection{Rule \#2}

Remember the burglar example, if I knew that the burglar alarm went off, then what happens to A (Earthquake) and C (Burglar)? The answer is that they become dependent! Knowing that a burglar came, explains away the probability that the alarm was caused by an earthquake. The general relationship for this case can be seen in Figure \ref{fig:graph7}. This is the converging arrows case that causes conditional dependencies in the landmark localization formulation, seen later in Figure \ref{fig:landmark2}.

Additionally, with the converging arrows case, we must be careful since any \textbf{descendent} of a node with converging arrows point to it, such as B in Figure \ref{fig:graph7}, will facilitate a path from A to C. This can be seen more formally in Figure \ref{fig:graph8}. We can model our intuition using the burglar alarm and by adding a new variable D, which represents a police car. If, we observe that a police car is driving by, there is a higher likelihood that there was an alarm. If there is a higher likelihood that there was an alarm and there was actually a burglary--we could reason that there would be a lower chance of an earthquake and thus, they would not be conditionally independent. 

\begin{figure}[h]
\begin{center}
\begin{pspicture}(-1,-1)(5,3)
\psset{arrowscale=2} 
\rput(0,2){\circlenode{a}{\makebox[1cm]{$A$}}}
\pscircle*[linecolor=cyan](2,0){.6cm}
\rput(2,0){\circlenode{b}{\makebox[1cm]{$B$}}}
\rput(4,2){\circlenode{c}{\makebox[1cm]{$C$}}}
\ncline[arrows=->]{a}{b}
\ncline[arrows=->]{c}{b}
\end{pspicture}
\end{center}
\caption{\textbf{UNBLOCKED} $A$ is conditionally dependent on $C$ given $B$.}
\label{fig:graph7}
\end{figure}

\begin{figure}[h]
\begin{center}
\begin{pspicture}(-1,-1)(5,5)
\psset{arrowscale=2} 
\rput(0,4){\circlenode{a}{\makebox[1cm]{$A$}}}
\pscircle*[linecolor=cyan](2,0){.6cm}
\rput(2,0){\circlenode{d}{\makebox[1cm]{$D$}}}
\rput(2,2){\circlenode{b}{\makebox[1cm]{$B$}}}
\rput(4,4){\circlenode{c}{\makebox[1cm]{$C$}}}
\ncline[arrows=->]{a}{b}
\ncline[arrows=->]{c}{b}
\ncline[arrows=->]{b}{d}
\end{pspicture}
\end{center}
\caption{\textbf{UNBLOCKED} $A$ is conditionally dependent on $C$ given $D$.}
\label{fig:graph8}
\end{figure}


\subsection{Examples}
\subsubsection{Localization}

\begin{figure}[h]
\begin{center}
\begin{pspicture}(-1,-1)(5,3)
\psset{arrowscale=2}
\rput(0,2){\circlenode{a}{\makebox[1cm]{$x_1$}}}
\rput(2,2){\circlenode{b}{\makebox[1cm]{$x_2$}}}
\rput(4,2){\circlenode{c}{\makebox[1cm]{$x_3$}}}
\rput(0,0){\circlenode{d}{\makebox[1cm]{$o_1$}}}
\rput(2,0){\circlenode{e}{\makebox[1cm]{$o_2$}}}
\rput(4,0){\circlenode{f}{\makebox[1cm]{$o_3$}}}
\ncline[arrows=->]{a}{b}
\ncline[arrows=->]{b}{c}
\ncline[arrows=->]{a}{d}
\ncline[arrows=->]{b}{e}
\ncline[arrows=->]{c}{f}
\end{pspicture}
\end{center}
\caption{A sample localization bayesian network with internal states $x_i$ and observations $o_i$.}
\label{fig:localization}
\end{figure}


The standard localization model can be seen as represented in a Bayesian network in Figure \ref{fig: localization}. Pretend that you are given where a robot is located at time $x_3$. We may want to ask whether two quantities are conditionally independent. For example, we may ask whether $o_2$ is conditionally independent of $o_1$ given $x_3$.  We can write this more formally as seen in Equation \ref{eq:perp1}.

\begin{equation}
\label{eq:perp1}
o_2\perp o_1 | x_3	
\end{equation}

We often use the symbol $\perp$ to represent independence in graphical models. Equation \ref{eq:perp1} is actually false. There exists a path from $o_1$ to $x_1$, $x_2$, and back to $o_2$. Similarly, can we say that $o_1\perp o_3 | x_3$? Yes, because the path from $x_2$ to $o_3$ is blocked by $x_3$.

\subsubsection{SLAM}
Let's look at SLAM, how can we generalize this picture. See Figure \ref{fig:slam}. 

\begin{figure}[h]
\begin{center}
\begin{pspicture}(-1,-1)(5,5)
\psset{arrowscale=2}
\rput(0,4){\circlenode{a}{\makebox[1cm]{$x_1$}}}
\rput(2,4){\circlenode{b}{\makebox[1cm]{$x_2$}}}
\rput(4,4){\circlenode{c}{\makebox[1cm]{$x_3$}}}
\rput(0,2){\circlenode{d}{\makebox[1cm]{$o_1$}}}
\rput(2,2){\circlenode{e}{\makebox[1cm]{$o_2$}}}
\rput(4,2){\circlenode{f}{\makebox[1cm]{$o_3$}}}
\rput(0,0){\circlenode{g}{\makebox[1cm]{$m_1$}}}
\rput(2,0){\circlenode{h}{\makebox[1cm]{$m_2$}}}
\rput(4,0){\circlenode{i}{\makebox[1cm]{$m_3$}}}
\ncline[arrows=->]{a}{b}
\ncline[arrows=->]{b}{c}
\ncline[arrows=->]{a}{d}
\ncline[arrows=->]{b}{e}
\ncline[arrows=->]{c}{f}
\ncline[arrows=->]{g}{d}
\ncline[arrows=->]{h}{e}
\ncline[arrows=->]{i}{f}
\ncline[arrows=->]{g}{h}
\ncline[arrows=->]{h}{i}
\end{pspicture}
\end{center}
\caption{A sample localization and mapping bayesian network with internal states $x_i$, observations $o_i$, and mapping states $m_i$.}
\label{fig:slam}
\end{figure}


In this case, we're thinking of two uncertain quantities, the position ($x_i$) and the map ($m_i$). Tell me whether there exists conditional independence between  $o_1$ and $o_3$ now, if I tell you $x_2$. There is, because the observation tells you something about the map, and the map influences the likelihood of our future observation. There now exists a path from $o_1$ to $m_1$, $m_2$, $m_3$, and finally to $o_3$.

\newpage

\subsubsection{Landmark}
Now let's think of a landmark map. 


\begin{figure}[h]
\begin{center}
\begin{pspicture}(-1,-1)(7,9)
\psset{arrowscale=2}
\rput(0,8){\circlenode{a}{\makebox[1cm]{$x_0$}}}
\rput(2,8){\circlenode{b}{\makebox[1cm]{$x_1$}}}
\rput(4,8){\circlenode{c}{\makebox[1cm]{$x_2$}}}
\rput(6,8){\circlenode{k}{\makebox[1cm]{$x_3$}}}
\pscircle*[linecolor=cyan](0,6){.6cm}
\pscircle*[linecolor=cyan](2,6){.6cm}
\pscircle*[linecolor=cyan](4,6){.6cm}
\pscircle*[linecolor=cyan](6,6){.6cm}
\rput(0,6){\circlenode{d}{\makebox[1cm]{$o_0$}}}
\rput(2,6){\circlenode{e}{\makebox[1cm]{$o_1$}}}
\rput(4,6){\circlenode{f}{\makebox[1cm]{$o_2$}}}
\rput(6,6){\circlenode{j}{\makebox[1cm]{$o_3$}}}
\rput(0,4){\circlenode{g}{\makebox[1cm]{$l_1$}}}
\rput(0,2){\circlenode{h}{\makebox[1cm]{$l_2$}}}
\rput(0,0){\circlenode{i}{\makebox[1cm]{$l_3$}}}
\ncline[arrows=->]{a}{b}
\ncline[arrows=->]{b}{c}
\ncline[arrows=->]{c}{k}
\ncline[arrows=->]{a}{d}
\ncline[arrows=->]{b}{e}
\ncline[arrows=->]{c}{f}
\ncline[arrows=->]{g}{d}
\ncline[arrows=->]{g}{f}
\ncline[arrows=->]{h}{e}
\ncline[arrows=->]{i}{j}
\ncline[arrows=->]{k}{j}
\end{pspicture}
\end{center}
\caption{A sample landmark bayesian network with internal states $x_i$ and observations $o_i$ and landmarks $l_i$.}
\label{fig:landmark2}
\end{figure}

If we pose the case that we see all the observations, $o_0,o_1,o_2,...$, are the landmarks conditionally independent of each other? That is, is $l_1\perp l_2 | O$? This is a tricky case, where the converging arrows at $o_i$ create a path between $l_1$ and $x_0$.  This path extends through $x_1$ and back from $o_1$ to $l_2$. Thus, $l_1$ and $l_2$ are not conditionally independent given $o_0$ and $o_1$.  

We will see later that the more conditional independencies that our graphical models exhibit, the simpler computationally complexity we will have.  Likewise, if we can simply observe the values of X, we can prevent conditional dependencies between $l_1$ and $l_2$. This formalization is called Fast SLAM and can be seen in Figure \ref{fig:fastslam}. We will discuss this in more depth later.

\begin{figure}[h]
\begin{center}
\begin{pspicture}(-1,-1)(7,9)
\psset{arrowscale=2}
\pscircle*[linecolor=cyan](0,8){.6cm}
\pscircle*[linecolor=cyan](2,8){.6cm}
\pscircle*[linecolor=cyan](4,8){.6cm}
\pscircle*[linecolor=cyan](6,8){.6cm}
\rput(0,8){\circlenode{a}{\makebox[1cm]{$x_0$}}}
\rput(2,8){\circlenode{b}{\makebox[1cm]{$x_1$}}}
\rput(4,8){\circlenode{c}{\makebox[1cm]{$x_2$}}}
\rput(6,8){\circlenode{k}{\makebox[1cm]{$x_3$}}}
\pscircle*[linecolor=cyan](0,6){.6cm}
\pscircle*[linecolor=cyan](2,6){.6cm}
\pscircle*[linecolor=cyan](4,6){.6cm}
\pscircle*[linecolor=cyan](6,6){.6cm}
\rput(0,6){\circlenode{d}{\makebox[1cm]{$o_0$}}}
\rput(2,6){\circlenode{e}{\makebox[1cm]{$o_1$}}}
\rput(4,6){\circlenode{f}{\makebox[1cm]{$o_2$}}}
\rput(6,6){\circlenode{j}{\makebox[1cm]{$o_3$}}}
\rput(0,4){\circlenode{g}{\makebox[1cm]{$l_1$}}}
\rput(0,2){\circlenode{h}{\makebox[1cm]{$l_2$}}}
\rput(0,0){\circlenode{i}{\makebox[1cm]{$l_3$}}}
\ncline[arrows=->]{a}{b}
\ncline[arrows=->]{b}{c}
\ncline[arrows=->]{c}{k}
\ncline[arrows=->]{a}{d}
\ncline[arrows=->]{b}{e}
\ncline[arrows=->]{c}{f}
\ncline[arrows=->]{g}{d}
\ncline[arrows=->]{g}{f}
\ncline[arrows=->]{h}{e}
\ncline[arrows=->]{i}{j}
\ncline[arrows=->]{k}{j}
\end{pspicture}
\end{center}
\caption{The Fast SLAM formulation.}
\label{fig:fastslam}
\end{figure}

\newpage

\section{Gibbs Field}
A Gibbs Field is a collection of nodes that have undirected edges between them, this can be seen in Figure \ref{fig:undirected}.

\begin{figure}[h]
\begin{center}
\begin{pspicture}(-1,-1)(5,3)
\psset{arrowscale=2}
\rput(0,2){\circlenode{a}{\makebox[1cm]{$x_0$}}}
\rput(0,0){\circlenode{b}{\makebox[1cm]{$x_1$}}}
\rput(2,2){\circlenode{c}{\makebox[1cm]{$x_2$}}}
\rput(4,2){\circlenode{d}{\makebox[1cm]{$x_3$}}}
\rput(4,0){\circlenode{e}{\makebox[1cm]{$x_4$}}}
\ncline[arrows=-]{a}{b}
\ncline[arrows=-]{a}{c}
\ncline[arrows=-]{b}{c}
\ncline[arrows=-]{c}{e}
\ncline[arrows=-]{c}{d}
\ncline[arrows=-]{e}{d}
\end{pspicture}
\end{center}
\caption{A Gibbs Field with nodes $x_0,x_1,x_2,x_3,x_4$.}
\label{fig:undirected}
\end{figure}



A clique is a fully connected subset of the the graph.  $x_0$,$x_1$, and $x_2$ forms a clique and $x_2$, $x_3$, and $x_4$ also forms a clique. These cliques are known as maximal cliques because they are not part of any larger clique. We only need to pay attention to maximal cliques, even though several individual cliques exist, e.g. $x_0,x_1,...$.

We can represent a joint probability distribution, much like a Bayesian networks by multiplying a set of clique potential functions $\phi$ (see Equation \ref{eq:pot}). 

\begin{equation}
\label{eq:pot}
P(\vec{x}) = \frac{\prod_{cliques}\phi_{cliques}(X_{cliques})}{Z}
\end{equation}


The first clique has a function representing the probability distribution of the set of three variables $x_0, x_1, x_2$: $\phi(x_0,x_1,x_2)$.  Unlike normal probability distributions, these potential functions need necessarily normalize. There is also a potential function $\phi(x_2,x_3,x_4)$. Since the potential functions are not normalized, we must enforce a normalization constant, Z (see Equation \ref{eq:Z}) in our equation \ref{eq:pot} to create a valid probability distribution. 

\begin{equation}
\label{eq:Z}
Z = \sum_x \prod_{cliques} \phi_{cliques}(x_{cliques})
\end{equation}

Additionally, you might think of the potential functions as energy functions, such as $\phi(x_1,x_2)=e^{-(x_1-x_2)^2}$. Lower energies are obtained when $x_1$ and $x_2$ have almost the same value. We could derive the probability distribution then, by simply multiplying these cliques together and normalizing. The minimum energy state in this case is going to be flat. It's often common to have bigger cliques that capture the notion that not only is the ground flat, but it has constant slope. 

\subsection{Conditional Independence}
In a Gibbs field, conditional independency is simple. If there is any \textbf{unblocked} path between a set of nodes, they are conditionally dependent. Blocking is defined as simply observing a random variable. Conditionally independent is then defined iff there is no path to get from A to B.



\end{document}
