\scriptsize{
\begin{flushleft}


{\bfseries ALGORITHM AdaBoost.M1 customized version }\\
\bigskip
\bigskip
{\bfseries Input:}
\bigskip
\begin{itemize}
\item sequence of $N=M*K$ examples $<(x_1,y_1),...,(x_N,y_N)>$ with labels $y_i \in Y = \{1,...,K\}$  
\item distribution $D$ over the examples 
\item classifier 
\item integer $T$ specifying the number of iterations
\item learning ratio $l$
\end{itemize}
\bigskip
{\bfseries Initialize} the weight vector: $w_k^1 = D(k)=M$ for $i = 1,...,k$.\\
\bigskip
\bigskip
{\bfseries DO for} $t = 1,2,...,T$
\begin{enumerate}
 \item
 Call classifier, providing it with $w_k^t$ images for each class; get back the hypothesis $h_t: X \rightarrow Y$.
 \item
 Calculate the overall error rate $e_t$.
 \item
 Set $\beta_t = \frac{e_t}{1-e_t}$.
 \item
Let be $ER_k$ the error rate for class $k$ and $MER = arg \max_{k \in Y} ER_k$.\\
 Set the new weight vector to be 
 $$
 w_k^{t+1} = w_k^t \beta_t^{1 - ER_k/MER}
 $$
 Let be $MW = arg \max_{k \in Y} w_k^{t+1} $ and $mw = arg \min_{k \in Y} w_k^{t+1} $, then 
 rescale the weights between $l \times mw$ and $MW$.
 \end{enumerate}
 {\bfseries Output} the hypothesis
 $$
 h_f(x) = arg \max_{y\in Y} \sum_{t=1}^T (log \frac{1}{\beta_t})\vdash h_t(x_i) = y_i \dashv
 $$
 
 
\end{flushleft} 
}
