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

\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 \#12 (Thursday October $2^{nd}$)}{Lecturer: Drew Bagnell}{Scribe: Don Burnette}{Support Vector Machines Continued}


\section{Support Vector Machine Tricks}

\begin{itemize}
\item Phrase learning problems as constraints, or patches (e.g. `A' is better than `B')
\item Soften Contraints - Account for mistakes (could be wrong), and removes constraints from problem
\item Add margin as a method to fix degeneracies and improve generalization
\item Can use a unified batch method (randomization is key) or an online approach
\item Take advantage of the fact that the max of a convex functions is convex
\end{itemize}

\section{Binary Support Vector Machine}
We consider the case of support vector machines where the result is binary. Suppose we can given a set $\{(x_{i},y_{i})\}$, where $x_{i}$ is the input vector and $y_{i}$ is the true value.
\begin{itemize}
\item If $y_{i} = 1$, we want $w^{T}x_{i} \geq 1$, otherwise we want $w^{T}x_{i} \leq -1$. This can be written more compactly as
\begin{equation}
y_{i}w^{T}x_{i} \geq 1
\end{equation}
\item As in the general case, we add a softening term $\xi_{i}$, where $\xi_{i} \geq 0$. Our contraint then becomes
\begin{eqnarray}
y_{i}w^{T}x_{i} &\geq& 1 - \xi_{i}\\
\xi_{i} &\geq& 1 - y_{i}w^{T}x_{i}
\end{eqnarray}
\item We wish to minimize $\frac{\lambda ||w||^{2}}{2} + \sum_{i}{max(0,1-y_{i}w^{T}x_{i})}$
\item The loss for each data point is then $l_{i} = \frac{\lambda ||w||^{2}}{2} + max(0,1-y_{i}w^{T}x_{i})$
\item If $max(0,1-y_{i}w^{T}x_{i}) = 0$, then the gradient becomes
\begin{equation}
\nabla l_{i} = \lambda \vec{w}
\end{equation}
\item If $max(0,1-y_{i}w^{T}x_{i}) = 1-y_{i}w^{T}x_{i}$, then the gradient becomes
\begin{equation}
\nabla l_{i} = \lambda \vec{w} - y_{i}x_{i}
\end{equation}
\item This loss function is often called the `Hinge Loss'
\item Hinge loss is a convex upper bound on the `0/1' Loss
\end{itemize}

\section{More Applications of Online Learning}
Projected gradient descent applied to range images. Two neighbooring pixels in an image are likely to be the same depth if they are the same color.

\begin{itemize}
\item Use a random field, one node per pixel
\item Penalize depth changes
\item We calculate the probability desity by taking the product over maximal cliques
\begin{equation} 
	p(\vec{d}) = \prod_{i\in O}{e^{-\gamma |z_{i}-d_{i}|^{2}}}\prod_{i,j\in N}{e^{-c_{ij} |d_{i}-d_{j}|^{2}}}
\end{equation}
where $O$ are the observed nodes, are $N$ are neighbooring nodes. If ${Pixel}_{i}$ and ${Pixel}_{j}$ are `close' then ${c}_{ij} = 1$, else ${c}_{ij} = \epsilon \ll 1$
\item We wish to compute $argmax \left(p(\vec{d})\right)$
\begin{eqnarray}
&=& argmax\left( \log p(\vec{d})\right)\\
&=& argmax\left(\sum_{i}{-\gamma |z_{i}-d_{i}|^{2}} + \sum_{i,j}{-c_{ij} |d_{i}-d_{j}|^{2}}\right)\\
&=& argmin\left(\sum_{i}{\gamma |z_{i}-d_{i}|^{2}} + \sum_{i,j}{c_{ij} |d_{i}-d_{j}|^{2}}\right)\\
\end{eqnarray}
\item Calculate gradient
\begin{equation}
\frac{\partial}{\partial d_{i}}l = -2\gamma(z_{i}-d_{i}) + \sum_{j\in N}{2c_{ij}(d_{i}-d_{j})}
\end{equation}
\item Apply update rule
\end{itemize}

\end{document}
