\documentclass[a4paper]{article}

\usepackage{amssymb}
\usepackage{booktabs}
\usepackage{geometry}

\title{Exercise: Machine Learning}
\author{Mart Lubbers}
\date{\today}

\begin{document}
\maketitle
\subsection*{Chapter 5: Machine Learning}
Table~\ref{t2} shows that there is some difference in classification when
choosing different parameter sets. The results show that adding the focus word
is very important knowledge since the percentage increases quite a bit.
However, knowing only the focus word gives exceptionally low performance.

Knowing the next words or the previous words gives some improvement but not a
whole lot.

Table~\ref{t1} shows that the method does not make a big difference.

Using ten-fold cross validation decreases the percentage.
		
\begin{table}
	\centering
	\begin{tabular}{lll}
		\toprule
		Method & Correctly classified & Root relative squared error\\
		\midrule
		\emph{NaiveBayes} & $96.6449\%$ & $35.7222\%$\\
		\emph{NaiveBayes (10FCF)} & $96.4352\%$ & $37.1926\%$\\
		\emph{J48} & $96.6449\%$ & $34.9136\%$\\
		\emph{J48 (10FCF)} & $96.4352\%$ & $36.5122\%$\\
		\bottomrule
	\end{tabular}
	\caption{Results for \texttt{P1D} and \texttt{FD}\label{t1}}
\end{table}

\begin{table}
	\centering
	\begin{tabular}{lllllll}
		\toprule
		\texttt{P2D} & \texttt{P1D} & \texttt{N2D} & \texttt{N1D} & \texttt{FW} & Correctly classified\\
		\midrule
		\checkmark{} & \checkmark{} & \checkmark{} & \checkmark{} & \checkmark{} & $98.3225\%$\\
		\checkmark{} & \checkmark{} & \checkmark{} & \checkmark{} & & $97.3905\%$\\
		\checkmark{} & \checkmark{} & & \checkmark{} & \checkmark{} & $98.5555\%$\\
		\checkmark{} & \checkmark{} & & \checkmark{} & & $97.507\%$\\
		\checkmark{} & \checkmark{} & & & \checkmark{} & $98.0429\%$\\
		\checkmark{} & \checkmark{} & & & & $95.5732\%$\\
		
		& \checkmark{} & \checkmark{} & \checkmark{} & \checkmark{} & $98.6486\%$\\
		& \checkmark{} & \checkmark{} & \checkmark{} & & $97.5769\%$\\
		& \checkmark{} & & \checkmark{} & \checkmark{} & $98.5555\%$\\
		& \checkmark{} & & \checkmark{} & & $97.973\%$\\
		& \checkmark{} & & & \checkmark{} & $98.2992\%$\\
		& \checkmark{} & & & & $96.6449\%$\\
		
		& & \checkmark{} & \checkmark{} & \checkmark{} & $91.8919\%$\\
		& & \checkmark{} & \checkmark{} & & $85.5079\%$\\
		& & & \checkmark{} & \checkmark{} & $92.579\%$\\
		& & & \checkmark{} & & $85.2516\%$\\
		& & & & \checkmark{} & $88.4436\%$\\
		\bottomrule
	\end{tabular}
	\caption{\emph{NaiveBayes} on all sensible combinations\label{t2}}
\end{table}

\subsection*{Chapter 6: Exercises}
\begin{itemize}
	\item\emph{If we look at the Viterbi algorithm, we see that the
		probability of state at a given position is calculated $n$ the basis of
		the preceding $n$ states. However, it is claimed that the algorithm
		takes into account the whole sequence. Explain in your own words (at
		most $100$) how the probability is influenced by the rest of the
		sequence, i.e.\ both the positions more than $n$ back and the following
		positions.}

		A probability is always based on the most probably preceding sequence,
		however there are no backpointers to all states. Thus the probability
		is not based on all possible previous paths and you can only recover
		the most likely path. The following states are also of an influence
		since when the path does not belong to the most likely sequence it will
		not be connected to the final path via a backpointer and will be lost.

	\item\emph{Explain in your own words (at most 50) how the EM algorithm
		works. I don't mean the mathematics, but the underlying concept.}

		The \emph{Expectation-Maximization}-algorithm (EM) searches for the
		settings of parameters where the likelihood is (locally) optimal. 
		The algorithm usually takes the derivative of the likelihood function
		to get the maximum value.
\end{itemize}
\end{document}
