%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NOTE: delete ,psfig here if using on athena
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentstyle[12pt,twoside,alltt,psfig]{article}
\textwidth=6in
\oddsidemargin=0.25in
\evensidemargin=0.25in
\topmargin=-0.1in
\footskip=0.8in
\parindent=0.0cm
\parskip=0.3cm
\textheight=8.00in
\setcounter{tocdepth} {3}
\setcounter{secnumdepth} {2}
\sloppy

\newenvironment{proof}{\noindent{\bf Proof:}}{\qed\bigskip}
\newenvironment{proof_sketch}{\noindent{\bf Sketch of Proof:}\hspace*{1em}}{\qed\bigskip}

\newtheorem{theorem}{Theorem}
\newtheorem{corollary}{Corollary}
\newtheorem{lemma}{Lemma}
\newtheorem{claim}{Claim}
\newtheorem{fact}{Fact}
\newtheorem{definition}{Definition}
\newtheorem{assumption}{Assumption}
\newtheorem{observation}{Observation}
\newtheorem{example}{Example}
\newcommand{\qed}{\rule{7pt}{7pt}}



\newcounter{lecnum}
\renewcommand{\thepage}{\thelecnum-\arabic{page}}
\renewcommand{\thesection}{\thelecnum.\arabic{section}}
\renewcommand{\theequation}{\thelecnum.\arabic{equation}}
\renewcommand{\thefigure}{\thelecnum.\arabic{figure}}
\renewcommand{\thetable}{\thelecnum.\arabic{table}}



\newcommand{\lecture}[6]{
\pagestyle{myheadings} \thispagestyle{plain} \newpage
\setcounter{lecnum}{#1} \setcounter{page}{1} \noindent \begin{center}
\framebox{ \vbox{ \hbox to 6.28in { {\bf 6.858 Machine Learning
\hfill Lecture #1: #2} } \vspace{4mm} 
\vspace{2mm} \hbox to 6.28in { {\it
Lecturer: #3 \hfill Scribe: #4} } } } \end{center}
\markboth{Lecture #1: #2}{Lecture #1: #2} \vspace*{4mm} }



\begin{document}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Lecture command takes 4 arguments:
%		ordinal number of the lecture
%		date of the lecure
%		lecturer
%		scribe---that is you.
%
% Fill out the next line with this information !!!
\lecture{2 }{September 12, 1994}{Ron Rivest}{Deniz Yuret} 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Your notes start here!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% For theorems, lemmas, definitions, remarks, etc. use commands
% {\theorem{...}}, {\lemma{...}}, {\definition{...}}, etc.
% For proofs, use \begin{proof} ... \end{proof}
%
% For figures use the following block:
%
% \begin{figure}[h]
% \begin{center}
% \mbox{\psfig{figure=notes-nn-fig-mm.ps}}
% \caption{A very nice picture.}
% \label{fig:picture}
% \end{center}
% \end{figure}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Outline}
\begin{itemize}
\item On-line learning with mistake bounds 
\item Optimal and Halving algorithms
\item Winnow1 algorithm for $\{x_{i_1} \vee x_{i_2} \vee \ldots \vee x_{i_k}\}$
\end{itemize}

\section{On-line learning with mistake bounds}
\subsection{Review of the learning model}
\begin{tabular}{ll}
\parbox[t]{2.5in}{$x^{(1)},x^{(2)},\ldots \rightarrow c_{\ast}$} &
\parbox[t]{3.5in}{The goal of concept learning is to discover an unknown target
concept from labeled instances.  On-line learning makes a prediction for each
instance.  In the mistake bound model the goal is to minimize the number of
prediction mistakes.}
\\ \\
\parbox[t]{2.5in}{${\cal X} = \{0,1\}^n $} &
\parbox[t]{3.5in}{Instance space ${\cal X}$ consists of instances described by
bit vectors of length n.}
\\ \\
\parbox[t]{2.5in}{$c \in {\cal C}, c:{\cal X} \rightarrow \{0,1\}$} &
\parbox[t]{3.5in}{Class of concepts ${\cal C}$ consists of concepts which
classify each instance as negative or positive.}
\\ \\ 
\parbox[t]{2.5in}{$c_{\ast} \in {\cal C}: \\
\hspace*{2ex} c_{\ast}(x) = 1 \Rightarrow positive\ example \\
\hspace*{2ex} c_{\ast}(x) = 0 \Rightarrow negative\ example$} &
\parbox[t]{3.5in}{There is an unknown target concept the learner is trying to
discover.}
\\ \\ 
\parbox[t]{2.5in}{\em
for $i = 1,2,\ldots$\\
\hspace*{2ex} learner given $x^{(i)} \in {\cal X}$\\
\hspace*{2ex} learner predicts $c_{\ast}(x^{(i)})$\\
\hspace*{2ex} learner is told  $c_{\ast}(x^{(i)})$} &
\parbox[t]{3.5in}{The learning process keeps predicting and learning in a loop.} 
\end{tabular}

\subsection{Minimum number of mistakes}
With the mistake bound approach, we define the optimal algorithm as one that
has the best worst-case bound:
\[Opt({\cal C}) = \min_{learners\ L}\ \max_{c_{\ast}\in{\cal C}}
\ \max_{examples\ x^{(i)}}\ \left(
\parbox{1.5in}{number of mistakes made by $L$ when learning $c_{\ast}$
from examples $x^{(i)}$}
\right)\]
Some obvious bounds we can show on $Opt({\cal C})$ are:\\
\begin{tabular}{ll}
\\
\parbox[t]{1.5in}{$Opt({\cal C}) \leq 2^n$} &
\parbox[t]{4.5in}{There are only $2^n$ possible instances.}
\\ \\
\parbox[t]{1.5in}{$Opt({\cal C}) \leq |{\cal C}|-1$} &
\parbox[t]{4.5in}{Learner predicts according to the first remaining $c$.}
\\ \\ 
\parbox[t]{1.5in}{$Opt({\cal C}) \leq log(|{\cal C}|)$} & 
\parbox[t]{4.5in}{We will achieve this bound by using the halving algorithm.}
\end{tabular}

\section{Optimal and Halving algorithms}
\subsection{Version space}

Let \parbox[t]{5in}{$V_0 = {\cal C}$,\\
$V_i = \{c \in {\cal C}: c $ is consistent with the first $i$ 
labeled examples$\}$}

$V_i$ is called the $i$'th ``version space'' in AI terminology due to Mitchell.
$V_i$ represents the remaining possible concepts.

Let \parbox[t]{5in}{
$\xi_0({\cal C},x) = \{c \in {\cal C} : c(x) = 0\}$ \\
$\xi_1({\cal C},x) = \{c \in {\cal C} : c(x) = 1\}$
}

Then for $i > 1$, $V_i = \left\{ \begin{array}{ll}
\xi_0(V_{i-1},x^{(i)})$ if $c_{\ast}(x^{(i)}) = 0 \\ 
\xi_1(V_{i-1},x^{(i)})$ if $c_{\ast}(x^{(i)}) = 1
\end{array}\right.$

\subsection{Halving algorithm}

The halving algorithm is an on-line learning algorithm which always
predicts by the majority of concepts in the current version space.

\vspace{.1in}
\fbox{
On input $x^{(i)}$, predict \parbox[t]{2.5in}{
1 if $|\xi_1(V_{i-1},x^{(i)})| \geq |\xi_0(V_{i-1},x^{(i)})|$, \\
0 otherwise.
}}

{\bf Theorem:} $Opt({\cal C}) \leq \lg|{\cal C}|$

{\bf Proof:} At each step the halving algorithm predicts according to the
majority of concepts that are still in the version space.  Thus when a mistake
is made, more than half of the candidate concepts is eliminated. \qed

Note that the halving algorithm may not be efficient, since determining and
representing $V_i$'s and their sizes may be hard.

\subsection{Optimal algorithm}

\fbox{
On input $x^{(i)}$ predict \parbox[t]{3.2in}{
1 if $ Opt(\xi_1(V_{i-1},x^{(i)})) \geq Opt(\xi_0(V_{i-1},x^{(i)}))$, \\
0 otherwise.
}}

The halving algorithm is not optimal.  Instead of guessing in accordance with
the majority of the valid concepts, we should guess according to the concept
group that gives us the least number of expected mistakes.  However this
optimal algorithm is computationally even less efficient.

There are cases where the bound $\lg|{\cal C}|$ is not tight.  Take the example
instance space of a large number of integers.  The target concept is being one
particular integer.  By always guessing false, the optimal algorithm can only
make one possible mistake.

\subsection{Randomized halving algorithm} 
 
\fbox{
Predict according to $c^{(i)}\in V_i$ selected at random.
}

On any step, the halving algorithm may not predict according to any concept.
The prediction is based on a majority vote, and there may not be a single
concept consistent with the majority votes.  The randomized halving algorithm
(due to Maass~\cite{Maass91}), on the other hand, bases its predictions on a randomly selected
$c^{(i)} \in V_i$.

{\bf Theorem:} The expected number of mistakes randomized halving algorithm
makes $\leq ln|{\cal C}|+O(1)$. 

{\bf Proof:} Assume that the sequence of examples are chosen independent of the
learner's behavior.  Thus $x^{(1)},x^{(2)},\ldots$ can be seen as a fixed
sequence of examples.  At step $i$, $V_i$ is the set of remaining concepts.
These concepts can be ordered by when they are going to be eliminated by the
examples.  Let $c^{(1)},c^{(2)},\ldots,c^{(r)}$ be this order, where $r=|V_i|$.
Let $M_r$ be the expected number of mistakes to be made.  To derive a
recurrence, note that the algorithm is equally likely to pick one of
$c^{(1)},c^{(2)},\ldots,c^{(r)}$ as the concept which it will predict according
to at this step.  With probability $1/r$, it will pick $c^{(r)}$, and make no
more mistakes.  With probability $(r-1)/r$ it will pick one of $c^{(i)}$, where
$i<r$.  It will then make at least one mistake, plus the expected number of
mistakes for the remaining $r-i$ concepts, i.e.  $M_{r-i}$.
\begin{eqnarray*}
M_1 & = & 0\\
M_r & = & \frac{r-1}{r}\left[ 1+\frac{M_1 + M_2 + \cdots + M_{r-1}}{r-1}\right]
\\
& = & \frac{r-1}{r}+\frac{M_1 + M_2 + \cdots + M_{r-1}}{r} \\
rM_r & = & (r-1) + M_1 + M_2 + \cdots + M_{r-1} \\
(r-1)M_{r-1} & = & (r-2) + M_1 + M_2 + \cdots + M_{r-2} \\
r(M_r - M_{r-1})+M_{r-1} & = & 1 + M_{r-1} \\
M_r & = & M_{r-1} + 1/r \\
M_r & = & \sum_{i=2}^{r} 1/i = ln(r)+O(1)
\end{eqnarray*}

\section{Winnow algorithm}

%%%%%%%\subsection{Restricted concept classes}

So far, we have seen algorithms for general concept classes.  In this
section we will consider a restricted concept class: monotone
disjunctions of at most $k$ variables.  We will analyze the Winnow
algorithm (due to Littlestone~\cite{Littlestone88}) which makes at
most $O(k\lg n)$ mistakes.  This bound is particularly useful when $n$
is large and $k$ is restricted (i.e., when there are many irrelevant
attributes).
\begin{eqnarray*}
{\cal C} & = & \{x_{i_1} \vee x_{i_2} \vee \ldots \vee x_{i_k}\} \\
|{\cal C}| & = & 
\left(\begin{array}{c} n \\ k \end{array}\right) +
\left(\begin{array}{c} n \\ k-1 \end{array}\right) +
\cdots +
\left(\begin{array}{c} n \\ 0 \end{array}\right) \\
\lg|{\cal C}| & = & \Theta(k\lg n)
\end{eqnarray*}  

We know that this is the bound for the optimal algorithm.  However this does
not tell us how to implement it efficiently.

%%%%%%%%%\subsection{Duality}

We could try to use the on-line conjunction learning algorithm from the last
lecture, based on the following duality principle:
\[c(x) = x_{i_1} \vee x_{i_2} \vee \ldots \vee x_{i_k}
\Rightarrow
\overline{c}(x) = \overline{x}_{i_1}\overline{x}_{i_2} \ldots
\overline{x}_{i_k}\] 
However, this algorithm will give us the bound of $n+1-k$, which is linear in
the total number of attributes.  It would not be useful when there is a large
number of irrelevant attributes compared to relevant ones.

%%%%%%%%%\subsection{Linear separability}

Instead, we will learn disjunctions by an algorithm for learning 
linearly separable Boolean functions.  A concept $c$ is {\em linearly
separable} if $\exists w \in \Re^n, \Theta \in \Re$ such that
\[\forall x\ c(x) = 1 \Leftrightarrow w \cdot x \geq \Theta\] In other
words, a function from $\{0,1\}^n$ to $\{0,1\}$ is linearly separable
if there is a hyperplane in $\Re^n$ separating the points on which the
function is $1$ from the points on which it is $0$.  Monotone
disjunctions are linearly separable.  That is, for any concept
$x_{i_1} \vee x_{i_2} \vee \ldots \vee x_{i_k}$, the separating
hyperplane is given by $x_{i_1} + x_{i_2} + \cdots + x_{i_k} \geq
1/2$.

We now give the Winnow1 algorithm for learning monotone disjunctions.
We present it as a linear-threshold algorithm, where the algorithm
learns appropriate  weights $w$.

%%%%%%%%%%\subsection{Winnow algorithm}

\fbox{\parbox[t]{5.5in}{
Initialize $\Theta = n/2$, $w = (1,1,\ldots,1)$\\
Predict $c(x) = 1$ iff $w \cdot x > \Theta$ \\
If prediction OK, do nothing \\
If $c(x) = 1$ but $w \cdot x \leq \Theta$, double all the weights $w_i$ where
$x_i = 1$ (promotion)\\
If $c(x) = 0$ but $w \cdot x > \Theta$, zero all the weights $w_i$ where
$x_i = 1$ (elimination)
}}

{\bf Theorem:} Winnow1 makes $O(k\lg n)$ mistakes.

{\bf Proof:} Let $u$ be the number of false negatives (promotions), and $v$ the
number of false positives (eliminations).  The total number of mistakes is
$u+v$.

{\em Lemma 1:} $v \leq n/\Theta + u$ \\
In the case of a promotion, the increase in the weights is at most $\Theta$.
The algorithm doubles a subset of the weights which did not add up to $\Theta$.
Conversely, in the case of an elimination, the decrease in the weights is at
least $\Theta$.  The algorithm zeroes a subset of the weights that added up to
more than $\Theta$.  The sum of the weights can never go below zero, since they
are either doubled or zeroed, and they start positive.  Thus $0 \leq \sum w_i
\leq n + u.\Theta - v.\Theta \Rightarrow v \leq n/\Theta + u$.

{\em Lemma 2:} $w_i \leq 2\Theta$ \\
A promotion occurs only if the sum of the relevant weights is less than
$\Theta$.  Thus a single weight which is above $\Theta$ can never be doubled.  

{\em Lemma 3:} After $u$ promotions, $\exists w_i$ such that $\lg w_i \geq
u/k$. \\
Each promotion must double one of $w_{i_1},w_{i_2},\ldots,w_{i_k}$.  Each
doubling adds 1 to the logarithm.

{\em Claim:} $u+v \leq 2k(\lg\Theta+1)+n/\Theta$
\begin{eqnarray*}
u/k & \leq & \lg w_i \leq\lg\Theta + 1 \parbox{2in}{\hfill by Lemmas 2 and 3}\\
u & \leq & k(\lg \Theta + 1) \\
v & \leq & n/\Theta + k(\lg \Theta + 1) \parbox{1.8in}{\hfill by Lemma 1} \\
\Rightarrow u+v & \leq & n/\Theta + 2k(\lg \Theta + 1)
\end{eqnarray*}
With $\Theta = n/2$, number of mistakes $\leq 2+2k\lg n$. \qed

\begin{thebibliography}{99}

\bibitem{Littlestone88} Nick Littlestone. Learning quickly when
irrelevant attributes abound: A new linear-threshold algorithm. {\em
Machine Learning}, 2:285-318, 1988.

\bibitem{Maass91} Wolfgang Maass.  On-line learning with an oblivious
environment and the power of randomization. {\em Proceedings of the
Fourth Annual ACM Workshop on Computational Learning Theory}, pp.
167-175, August 1991.

\end{thebibliography}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Your notes end here!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{document}

