\documentclass[11pt]{article}
\usepackage{latexsym}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{epsfig}
\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}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title / Header
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\lecture{Statistical Techniques in Robotics (16-831, F10)}{Lecture \#25 (Nov 16, 2010)}{Lecturer: Drew Bagnell}{Scribe: Dave Rollinson$^1$}{Kernel Machines}
\let\thefootnote\relax\footnotetext{$^1$Based on the scribe work of Daniel Munoz, Jack Singleton, and Sergio Valcarcel}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Section 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{References}
There are a number of books and papers on kernels and \textit{Reproducing Kernel Hilbert Spaces}.
\begin{itemize}
	\item Aronszajn and Bergman - \textit{Theory of Reproducing Kernels} 1950
	\item Wahba - \textit{Spline Models for Observational Data} 1990
	\item Cortes and Vapnik - \textit{Support-Vector Networks} 1995
\end{itemize}
The online algorithm in Section 3 is also described in this paper is a flavor of NORMA (Naive Online Regularized Risk Minimization Algorithm).
\begin{itemize}
	\item Kivinen, Smola, Williamson - \textit{Online Learning with Kernels} 2003
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Section 2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Review}
\begin{itemize}
\item
Ultimately, we wish to learn a function $f: \mathbb{R}^n \rightarrow \mathbb{R}$ that assigns
a meaningful score given a data point.  For example, in binary classification, we would like an $f(\cdot)$ 
to return positive and negative values, given positive and negative samples, respectively.

\item
A kernel $K: \mathbb{R}^n \times \mathbb{R}^n \rightarrow \mathbb{R}$ 
intuitively measures the \textit{correlation} between $f(\mathbf{x_i})$ and $f(\mathbf{x_j})$.  Considering
a matrix $\mathbf{K}$ with entries $K_{ij} = K(\mathbf{x_i}, \mathbf{x_j})$, then matrix 
$\mathbf{K}$ must satisfy the properties:
\begin{itemize}
	\item
	$\mathbf{K}$ is symmetric ($K_{ij} = K_{ji}$)
	\item
	$\mathbf{K}$ is positive-definite 
		($\forall \mathbf{x} \in \mathbb{R}^n : \mathbf{x} \neq \mathbf{0}, \mathbf{x^T K x} > 0$)
\end{itemize}
Hence, a valid kernel is the inner product: $K_{ij} = \langle\mathbf{x_i, x_j}\rangle$.  

\item
A function can be considered that is a weighted composition of many kernels 
centered at various locations $\mathbf{x_i}$:
\begin{equation}
  \label{eq:rkhs-function}
	f(\cdot) = \sum_{i=1}^Q \alpha_i K(\mathbf{x_i}, \cdot),
\end{equation}
where $Q$ is the number of kernels that compose $f(\cdot)$ and $\alpha_i \in \mathbb{R}$ is
each kernel's associated weight.  All functions $f(\cdot)$ with kernel $K$ that satisfy the above properties and can be written in the form of Equation \ref{eq:rkhs-function} are said to lie in a \textit{Reproducing Kernel Hilbert Space} (RKHS) $\mathcal{H}_K$: $f \in \mathcal{H}_K$
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Section 3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Online Kernel Machine - Algorithm}
\begin{itemize}
\item Initialize the function $f=0$.

\item For t = 1 to T:

\begin{enumerate}
	
	\item Observe some measurement over some set of features 
		\[x_t\]
	
	\item Predict the class using $f(x_t)$ 
		\[f(x_t) = \sum_{i=1}^n \alpha_i K(x_i, x_t)\]
	
	\item Receive loss based on the prediction from $f(x_t)$ and the true class $y_t$ 
		\[L(f(x_t),y_t)\]

	\item Update $f$ based on the gradient of the loss function $L$ and learning rate $\eta_t$.  Shrink the weights on previous kernel functions by  $(1-\eta_t \lambda)$.
		\[f_{t+1} \leftarrow  (1-\eta_t \lambda)f_t + \eta_{t} \nabla L(f(x_t),y_t)  \]

	\textit{For Kernel SVMs} the loss function is the hinge loss.  $f(x_t)$ is the prediction from the sum of weighted kernel functions and $y_t$ is a binary indicator of the true class, either -1 or 1. 
		\begin{equation} 
			L(f(x_t),y_t) = \max(0, 1-f(x_t)y_t)
		\end{equation}
		
	Like the loss function $L$, the gradient $\nabla L$ has two cases.  One where the prediction is correct by margin = 1, and the other where is not 	correct by margin = 1.  
		\begin{equation}
		\nabla L((x_t),y_t) = 
			\begin{cases}
			0 &$if $ (1 - y_i f(x_i)) \leq 0 \\
			L'(f(x_t),y_t) f'(x_t) = -y_t K(x_t, \cdot) & \text{otherwise}
			\end{cases}
		\end{equation}
	\end{enumerate}
	
	\item The regret is computed as: \[Regret = \sum_t (C_t(f_t(x_t)) - C_t(f^*(x_t))) | f^* \in H_k\]

The regret bound:\[Regret = ||\nabla C_t(f)||_k \cdot ||f^*||_k \sqrt T \]
$||f^*||$ is the size of the function.  $||\nabla C_t(f)||$ can get as big as $\alpha^TK\alpha$.
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Section 4
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Online Kernel Machines - Discussion}

\begin{itemize}
	\item As mentioned in the previous lecture, this algorithm qualitatively corresponds to adding weighted 'bumps' that predicts some value based on the kernel function in each new observation's neighborhood of the feature space in $x$.
		
	\item As time progresses and the data set grows, the prediction step will take longer and longer to compute.  To shorten this computation time you may want to throw out old data points by weight or age.  If interested, there are some papers on that use tricks to find sparse solutions to large-scale problems:
\begin{itemize}
	\item Rahimi and Recht - \textit{Random Features for Large-Scale Kernel Machines} 2007
	\item Dekel, Shalev-Shwartz and Singer \textit{The Forgetron: A Kernel-Based Perceptron on a Budget} 2007
\end{itemize}
	
	\item The choice and tuning of the kernel and their corresponding bandwidth parameters are what affect the bias-variance tradeoff.  These are parameters that need to be tuned in addition to the learning rate $\eta$ and decay rate $\lambda$ from the update equations.
	\begin{itemize}
		\item Often simple kernels work quite well.  When approaching a new problem it is usually a good idea start with linear or polynomial kernels.  Radial basis functions are another good kernel to try early on.  Note that any kernels $K_1$ and $K_2$ that satisfy the conditions mentioned in Section 2 can be summed to form a new valid kernel.
	\end{itemize}
	
\end{itemize}


\end{document}
