\documentclass[11pt]{article}
\usepackage{latexsym}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{epsfig}
\usepackage[tight]{subfigure}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{graphicx}

\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 \#17 (Tuesday October $21^{st}$)}{Lecturer: Drew Bagnell}{Scribe: Veaceslav Arabagi}{Gaussian Processes}

\section{Motivational examples for Gaussian Processes (GP)}

\begin{itemize}
\item State of the art nonlinear regressions done with GP Bayes filter
\item Used in reverse kinematics, dynamics, modeling
\item Concrete example: \emph{Modeling of soil properties} \footnote{J. P. Gonzalez, S. Cook, T. Oberthur, A. Jarvis, J. A. Bagnell and M. Bernardine, \textit{Creating Low-Cost Soil Maps for Tropical Agriculture using Gaussian Processes}, JCAI 2007, Jan 2007.}

\begin{itemize}
\item Task: Model the distribution of soil pH throughout Honduras land
\item A limited set of datapoints of soil pH at fixed locations through the country is provided
\item Variables influencing soil pH: sunlight, rainfall amount, topography, vegetation etc
\item Used state of the art GP Bayes filter to predict the mean soil pH  and the prediction variance, or confidence (\ref{fig:Honduras_pH})

\end{itemize}
\end{itemize}

\begin{figure}[htb]
	\centering
	\includegraphics[width=0.70\textwidth]{Honduras_pH.jpg}
	\caption{Predicted map of pH in topsoil and 67\% confidence interval.}
	\label{fig:Honduras_pH}
\end{figure}


\section{High level idea behind GP's}
\begin{itemize}
\item Cconsider a function as a really long list of numbers, a vector of numbers
\item For discrete set of locations build a Gaussian distribution on the vector
\item Generalize discrete covariance to continuous functions
\item Graphically
\end{itemize}

\begin{figure}[ht]
\begin{minipage}[b]{0.5\linewidth}
Consider $\vec{f(x)}=[f(x1), f(x2), f(x3), \ldots ,f(10)]^T$ then we can form a Gaussian distribution on this vector of the form:
\begin{equation}
p(\vec{f(x)}) = \frac{1}{z} e^{-(\vec{f}-\mu_f)^{T}\Sigma^{-1}(\vec{f}-\mu_f)}
\end{equation}
\centering
\includegraphics[scale=0.5]{sample_points.pdf}
\caption{Sample points for GP filter}
\vfill
\label{fig:sample_points}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[b]{0.5\linewidth}
Generalizing the idea of a distribution of a vector $\vec{f(x)}$ to continuous functions and using the expansion of the matrix exponent:
\begin{equation}
{(\vec{f}-\mu_f)^{T}\Sigma^{-1}(\vec{f}-\mu_f)=\sum_i \sum_j (f_i-\mu_i)\Sigma_{ij}^-1(f_i-\mu_i)}
\end{equation}
we obtain a distribution of continuous functions:
\begin{equation}
p(f)=\frac{1}{z} e^{-\frac{1}{2} \int{dx \int{dx' f(x) \Delta(x,x') f(x')}}}
\end{equation}
\centering
\includegraphics[scale=0.5]{sample_functions.pdf}
\caption{Sample function passing through training points for GP filter}
\label{fig:sample_functions}
\end{minipage}
\end{figure}

However, in the continuous function case the normalizer $\frac{1}{z}$ is effectively an integral over all functions, which is infinite. This is a big problem, however there exists a solution: marginalize all functions by looking at a discrete number of points. To do that we apply the marginalization rules:


\begin{equation}
\begin{gathered}
\mu_f=0, \\
\Sigma_{ff}=\left( \begin{array}{cccc}
\kappa(x_1,x_1)& \kappa(x_1,x_2) & \dotsb & \kappa(x_1,x_n)\\
\kappa(x_2,x_1)& \kappa(x_2,x_2) & \dotsb & \kappa(x_2,x_n)\\
\vdots & & & \vdots\\
\kappa(x_n,x_1)& \kappa(x_n,x_2) & \ldots & \kappa(x_n,x_n)\end{array} \right)
\end{gathered}
\end{equation}
where $\kappa(x,x')$ is the kernel function and effectively portrays how each point $x$ influences point $x'$. The kernel function is one of the most important concepts in Gaussian processes and is used to form the covariance $\Sigma$.
\subsection{Kernel functions}
Kernel functions must be positive definite and symmetric as the matrix $\Sigma$ they for has those properties. \\	
\emph{Sample kernel functions:}
\begin{itemize}
\item $\kappa(x, x')=e^{\frac{-(x-x')^2}{L}}$ \\
This is one of the simplest kernel functions that works surprisingly well. The parameter $L$ is the characteristic length and defines the distance over which the correlation of 2 points $(x,x')$ is effective. The smaller the length scale, the less each point will influence its neighbor.
\item $\kappa(x,x')=\delta(x-x')$\\
Effectively says that each point has no influence on its neighbor.
\item $\kappa(x,x')=\vec{x}^T \vec{x'}$\\
This kernel function results in Bayes linear regression.
\end{itemize}

\section{How to apply algorithm}

\begin{figure}[ht]
\begin{minipage}[b]{0.5\linewidth}
\vspace{1pt}
Consider a few datapoints in $\mathbb{R}^2$ as shown on right. We are interested in predicting the value of $f(x^*)$.\\
\\ \\ \\ \\
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[b]{0.5\linewidth}
\centering
\includegraphics[scale=0.5]{algorithm_application.pdf}
\caption{Training datapoints {x1,x2,x3} and one unknown datapoint $f(x^*)$.}
\end{minipage}
\end{figure}

Let $\vec{x} \equiv [x_1, x_2, x_3]^T$ and $\vec{f} \equiv [f(x_1), f(x_2), f(x_3)]^T$ then we have the distribution of points:
\begin{equation}
	\left( \begin{array}{c}
	\vec{f}\\
	f(x^*) \end{array} \right) \thicksim \mathbb{N} \left(
	0,
	\left[\begin{array}{cc}
	K_{\vec{x} \vec{x}} & K_{\vec{x} x^*}\\
	K_{x^* \vec{x}} & K_{x^* x^*} \end{array} \right] \right)
\end{equation}

We are interested in the conditional distribution $p=f(x^*)|f(x_1)f(x_2)f(x_3)$ therefore we can compute the mean and variance of the value $f(x^*)$ using rules for conditionalizing the Gaussian distribution.

\begin{equation*}
	\boxed{
	\begin{gathered}
	\mu_{f^*}=K_{\vec{x} x^*}^T K_{\vec{x} \vec{x}}^{-1} \vec{f} \\
	\Sigma_{f^*}=K_{x^* x^*}-K_{\vec{x} x^*}^T K_{\vec{x} \vec{x}}^{-1} K_{\vec{x} x^*}
	\end{gathered}}
\end{equation*}


\end{document}

