\documentclass[a4paper]{article}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsfonts}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage[margin=1in]{geometry}
\usepackage{enumitem}
\usepackage{multirow}
\usepackage{graphicx,wrapfig,lipsum}
\usepackage{graphicx} % for images
\usepackage{caption} % for captions under images/figures
\usepackage{url} % for urls

\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{5}

\title{CS 669 Assignment 1}

\author{Rohit Patiyal \\ Devang Bacharwar}

\date{\today}

\begin{document}

\maketitle

\vspace{2.0cm}

\tableofcontents

\clearpage

\section {Objective}
	To build Bayes and Naive-Bayes classifiers for different types of data sets :
	\subsection{2-D artificial Data of 3 or 4 classes}
		\begin{enumerate}
		  \item {Linearly separable data set}
		  \item {Nonlinearly separable data sets (3 Data sets)}
		  \item {Overlapping data set}
		\end{enumerate}
	\subsection{Real World data set}

\vspace{1.0cm}

\section{Procedure}
	\begin{enumerate}
	  \item {Data for each class is partitioned into 75 \% for training and 25
	  \% for testing }
	  \item {Mean and Covariances are calculated for each class using the
	  training data.}
	  \item {For points in a grid, likelihood is calculated for each class and is
	  labeled as of the class with the maximum likelihood probability.}
	  \item{For bayes classifier, the likelihood is assumed to be a multivariate
	  gaussian distribution }
	  \item {These labelled points are plotted with different colors to visualize
	  the different regions separated by the decision boundaries.}
	  \item {The testing data is also plotted over the regions, and observations
	  are made.}
	\end{enumerate}

\vspace{1.0cm}

\section{Observations}
	\subsection{Bayes Classifier}
		\subsubsection{Linearly separable data set}
			The decision boundary clearly separates the testing data according to the
			estimated classes, as the data forms widely separated clusters.
			Results are similar when the covariance is either taken as the average of
			individual class covariances and when the covariance is calculated using all
			classes' data together.

			%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

			\begin{figure}
				\begin{tabular}{|c|c|c|c|}
					\hline
					Pair/Cov &  Alltogther & Average & Different	\\
					\hline
					1 and
					2&\includegraphics[width=40mm,height=30mm]{bayes/ls/pair/12/all_cov.png}&\includegraphics[width=40mm,height=30mm]{bayes/ls/pair/12/avg_cov.png}
					&\includegraphics[width=40mm,height=30mm]{bayes/ls/pair/12/diff_cov.png}\\
					\hline
					1 and
					3&\includegraphics[width=40mm,height=30mm]{bayes/ls/pair/13/all_cov.png}&\includegraphics[width=40mm,height=30mm]{bayes/ls/pair/13/all_cov.png}
					&\includegraphics[width=40mm,height=30mm]{bayes/ls/pair/13/diff_cov.png}\\
					\hline
					2 and
					3&\includegraphics[width=40mm,height=30mm]{bayes/ls/pair/23/all_cov.png}&\includegraphics[width=40mm,height=30mm]{bayes/ls/pair/23/avg_cov.png}
					&\includegraphics[width=40mm,height=30mm]{bayes/ls/pair/23/diff_cov.png}\\
					\hline
				\end{tabular}
				\caption{Decision region plot for every pair of classes}
			\end{figure}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			 \includegraphics[width=\textwidth]{bayes/ls/all/all_cov.png}
		  	\captionof{figure}{ Decision region plot for all the classes together with the training data
superposed with alltogether covariance} % [4]
		  \label{gfx/image}
		\end{minipage}
		\begin{minipage}[t]{0.2\linewidth} % [2]
		\vspace{10pt} % [3]
			Correct   : 374	\\
			Incorrect : 1	\\
			Acurracy  : 99.733 \\
		\begin{center}
			\begin{tabular}{ |c|c|c|c|c| }
			\hline
			& & \multicolumn{3}{| c |}{Predicted} \\
			\hline
			& & Class 1 & Class 2 & Class 3\\
			\hline
			\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 125 & 0 & 0\\
			& Class 2 & 0 & 125 & 0\\
			& Class 3 & 0 & 1 & 124\\
			\hline
			\end{tabular}
			\end{center}
		\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{bayes/ls/all/avg_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with average covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 374	\\
				Incorrect : 1	\\
				Acurracy  : 99.733 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c|c| }
				\hline
				& & \multicolumn{3}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2 & Class 3\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 125 & 0 & 0\\
				& Class 2 & 0 & 125 & 0\\
				& Class 3 & 0 & 1 & 124\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{bayes/ls/all/diff_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with different covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 375	\\
				Incorrect : 0	\\
				Acurracy  : 100 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c|c| }
				\hline
				& & \multicolumn{3}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2 & Class 3\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 125 & 0 & 0\\
				& Class 2 & 0 & 125 & 0\\
				& Class 3 & 0 & 0 & 125\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

		\subsubsection{Non-Linearly separable data set }

			\paragraph{Data of Interlocking Classes}

			\noindent

				%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

			\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{bayes/nls/interlock/all/all_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with alltogether covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 239	\\
				Incorrect : 11	\\
				Acurracy  : 95.6000 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c| }
				\hline
				& & \multicolumn{2}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 118 & 7 \\
				& Class 2 & 4 & 121\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{bayes/nls/interlock/all/avg_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with average covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 239	\\
				Incorrect : 11	\\
				Acurracy  : 95.6000 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c| }
				\hline
				& & \multicolumn{2}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 118 & 7 \\
				& Class 2 & 4 & 121\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{bayes/nls/interlock/all/diff_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with different covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 240	\\
				Incorrect : 10	\\
				Acurracy  : 96 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c| }
				\hline
				& & \multicolumn{2}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 118 & 7 \\
				& Class 2 & 3 & 122\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

				%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

			\paragraph{A ring with a central mass}

			\noindent

				%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

			\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{bayes/nls/ring/all/all_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with alltogether covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 188	\\
				Incorrect : 187	\\
				Acurracy  : 50.133 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c| }
				\hline
				& & \multicolumn{2}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 46 & 29 \\
				& Class 2 & 158 & 142\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{bayes/nls/ring/all/avg_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with average covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 188	\\
				Incorrect : 187	\\
				Acurracy  : 50.133 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c| }
				\hline
				& & \multicolumn{2}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 46 & 29 \\
				& Class 2 & 158 & 142\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{bayes/nls/ring/all/diff_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with different covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 375	\\
				Incorrect : 0	\\
				Acurracy  : 100 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c| }
				\hline
				& & \multicolumn{2}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 75 & 0 \\
				& Class 2 & 0 & 300\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}
				%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

			\paragraph{Spiral Dataset}

			\noindent

		%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

			\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{bayes/nls/spiral/all/all_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with alltogether covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 188	\\
				Incorrect : 187	\\
				Acurracy  : 50.133 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c| }
				\hline
				& & \multicolumn{2}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 46 & 29 \\
				& Class 2 & 158 & 142\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{bayes/nls/spiral/all/avg_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with average covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 188	\\
				Incorrect : 187	\\
				Acurracy  : 50.133 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c| }
				\hline
				& & \multicolumn{2}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 46 & 29 \\
				& Class 2 & 158 & 142\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{bayes/nls/spiral/all/diff_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with different covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 375	\\
				Incorrect : 0	\\
				Acurracy  : 100 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c| }
				\hline
				& & \multicolumn{2}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 75 & 0 \\
				& Class 2 & 0 & 300\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}
				%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

		\subsubsection{Overlapping data set}
			%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

			\begin{figure}
			\begin{tabular}{|c|c|c|c|}
				\hline
				Pair/Cov &  Alltogther & Average & Different	\\
				\hline
				1 and
				2&\includegraphics[width=40mm,height=30mm]{bayes/over/pair/12/all_cov.png}&\includegraphics[width=40mm,height=30mm]{bayes/over/pair/12/avg_cov.png}
				&\includegraphics[width=40mm,height=30mm]{bayes/over/pair/12/diff_cov.png}\\
				\hline
				1 and
				3&\includegraphics[width=40mm,height=30mm]{bayes/over/pair/13/all_cov.png}&\includegraphics[width=40mm,height=30mm]{bayes/over/pair/13/avg_cov.png}
				&\includegraphics[width=40mm,height=30mm]{bayes/over/pair/13/diff_cov.png}\\
				\hline
				1 and
				4&\includegraphics[width=40mm,height=30mm]{bayes/over/pair/14/all_cov.png}&\includegraphics[width=40mm,height=30mm]{bayes/over/pair/14/avg_cov.png}
				&\includegraphics[width=40mm,height=30mm]{bayes/over/pair/14/diff_cov.png}\\
				\hline
				2 and
				3&\includegraphics[width=40mm,height=30mm]{bayes/over/pair/23/all_cov.png}&\includegraphics[width=40mm,height=30mm]{bayes/over/pair/23/avg_cov.png}
				&\includegraphics[width=40mm,height=30mm]{bayes/over/pair/23/diff_cov.png}\\
				\hline
				2 and
				4&\includegraphics[width=40mm,height=30mm]{bayes/over/pair/24/all_cov.png}&\includegraphics[width=40mm,height=30mm]{bayes/over/pair/24/avg_cov.png}
				&\includegraphics[width=40mm,height=30mm]{bayes/over/pair/24/diff_cov.png}\\
				\hline
				3 and
				4&\includegraphics[width=40mm,height=30mm]{bayes/over/pair/34/all_cov.png}&\includegraphics[width=40mm,height=30mm]{bayes/over/pair/34/avg_cov.png}
				&\includegraphics[width=40mm,height=30mm]{bayes/over/pair/34/diff_cov.png}\\
				\hline

			\end{tabular}
			\caption{Decision region plot for every pair of classes}
			\end{figure}

			\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{bayes/over/all/all_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with alltogether covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 450	\\
				Incorrect : 50	\\
				Acurracy  : 90.000 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c|c|c| }
				\hline
				& & \multicolumn{4}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2 & Class 3 & Class 4\\
				\hline
				\multirow{4}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1& 111 & 4 & 4 & 6\\
				& Class 2 & 1 & 116 & 0 & 8\\
				& Class 3 & 9 & 0 & 116 & 0\\
				& Class 4 & 6 & 12 & 0 & 107\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{bayes/over/all/avg_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with average covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 453	\\
				Incorrect : 47	\\
				Acurracy  : 90.600 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c|c|c| }
				\hline
				& & \multicolumn{4}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2 & Class 3 & Class 4\\
				\hline
				\multirow{4}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1& 111 & 6 & 4 & 4\\
				& Class 2 & 2 & 118 & 0 & 5\\
				& Class 3 &9 & 0 & 116 & 0\\
				& Class 4 & 5 & 12 & 0 & 108\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{bayes/over/all/avg_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with different covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 452	\\
				Incorrect : 48	\\
				Acurracy  : 90.400 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c|c|c| }
				\hline
				& & \multicolumn{4}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2 & Class 3 & Class 4\\
				\hline
				\multirow{4}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1& 113 & 4 & 4 & 4\\
				& Class 2 & 2 & 118 & 0 & 5\\
				& Class 3 & 12 & 0 & 113 & 0\\
				& Class 4 & 5 & 12 & 0 & 108\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
		\subsubsection{Real world data set}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			 \includegraphics[width=\textwidth]{bayes/real/all/all_cov.png}
		  	\captionof{figure}{ Decision region plot for all the classes together with the training data
superposed with alltogether covariance} % [4]
		  \label{gfx/image}
		\end{minipage}
		\begin{minipage}[t]{0.2\linewidth} % [2]
		\vspace{10pt} % [3]
			Correct   : 1386	\\
			Incorrect : 391	\\
			Acurracy  : 77.9966 \\
		\begin{center}
			\begin{tabular}{ |c|c|c|c|c| }
			\hline
			& & \multicolumn{3}{| c |}{Predicted} \\
			\hline
			& & Class 1 & Class 2 & Class 3\\
			\hline
			\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 510 & 1 & 30\\
			& Class 2 & 21 & 332 & 261\\
			& Class 3 & 7 & 71 & 544\\
			\hline
			\end{tabular}
			\end{center}
		\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{bayes/real/all/avg_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with average covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 1509	\\
				Incorrect : 268	\\
				Acurracy  :	84.9184 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c|c| }
				\hline
				& & \multicolumn{3}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2 & Class 3\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 510 & 5 & 26\\
				& Class 2 & 20 & 397 & 197\\
				& Class 3 & 7 & 13 & 602\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{bayes/real/all/diff_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with different covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 375	\\
				Incorrect : 0	\\
				Acurracy  : 100 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c|c| }
				\hline
				& & \multicolumn{3}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2 & Class 3\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 125 & 0 & 0\\
				& Class 2 & 0 & 125 & 0\\
				& Class 3 & 0 & 0 & 125\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

			\begin{figure}
				\begin{tabular}{|c|c|c|c|}
					\hline
					Pair/Cov &  Alltogther & Average & Different	\\
					\hline
					1 and
					2&\includegraphics[width=40mm,height=30mm]{bayes/real/pair/12/all_cov.png}&\includegraphics[width=40mm,height=30mm]{bayes/real/pair/12/avg_cov.png}
					&\includegraphics[width=40mm,height=30mm]{bayes/real/pair/12/diff_cov.png}\\
					\hline
					1 and
					3&\includegraphics[width=40mm,height=30mm]{bayes/real/pair/13/all_cov.png}&\includegraphics[width=40mm,height=30mm]{bayes/real/pair/13/all_cov.png}
					&\includegraphics[width=40mm,height=30mm]{bayes/real/pair/13/diff_cov.png}\\
					\hline
					2 and
					3&\includegraphics[width=40mm,height=30mm]{bayes/real/pair/23/all_cov.png}&\includegraphics[width=40mm,height=30mm]{bayes/real/pair/23/avg_cov.png}
					&\includegraphics[width=40mm,height=30mm]{bayes/real/pair/23/diff_cov.png}\\
					\hline
				\end{tabular}
				\caption{Decision region plot for every pair of classes}
			\end{figure}

		%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

	\subsection{Naive-Bayes classifier}

			\subsubsection{Linearly separable data set}
				%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

			\

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			 \includegraphics[width=\textwidth]{naivebayes/ls/all/all_cov.png}
		  	\captionof{figure}{ Decision region plot for all the classes together with the training data
superposed with alltogether covariance} % [4]
		  \label{gfx/image}
		\end{minipage}
		\begin{minipage}[t]{0.2\linewidth} % [2]
		\vspace{10pt} % [3]
			Correct   : 374	\\
			Incorrect : 1	\\
			Acurracy  : 99.733 \\
		\begin{center}
			\begin{tabular}{ |c|c|c|c|c| }
			\hline
			& & \multicolumn{3}{| c |}{Predicted} \\
			\hline
			& & Class 1 & Class 2 & Class 3\\
			\hline
			\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 125 & 0 & 0\\
			& Class 2 & 0 & 125 & 0\\
			& Class 3 & 0 & 1 & 124\\
			\hline
			\end{tabular}
			\end{center}
		\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{naivebayes/ls/all/avg_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with average covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 374	\\
				Incorrect : 1	\\
				Acurracy  : 99.733 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c|c| }
				\hline
				& & \multicolumn{3}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2 & Class 3\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 125 & 0 & 0\\
				& Class 2 & 0 & 125 & 0\\
				& Class 3 & 0 & 1 & 124\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{naivebayes/ls/all/diff_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with different covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 375	\\
				Incorrect : 0	\\
				Acurracy  : 100 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c|c| }
				\hline
				& & \multicolumn{3}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2 & Class 3\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 125 & 0 & 0\\
				& Class 2 & 0 & 125 & 0\\
				& Class 3 & 0 & 0 & 125\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

			\begin{figure}
				\begin{tabular}{|c|c|c|c|}
					\hline
					Pair/Cov &  Alltogther & Average & Different	\\
					\hline
					1 and
					2&\includegraphics[width=40mm,height=30mm]{naivebayes/ls/pair/12/all_cov.png}&\includegraphics[width=40mm,height=30mm]{naivebayes/ls/pair/12/avg_cov.png}
					&\includegraphics[width=40mm,height=30mm]{naivebayes/ls/pair/12/diff_cov.png}\\
					\hline
					1 and
					3&\includegraphics[width=40mm,height=30mm]{naivebayes/ls/pair/13/all_cov.png}&\includegraphics[width=40mm,height=30mm]{naivebayes/ls/pair/13/all_cov.png}
					&\includegraphics[width=40mm,height=30mm]{naivebayes/ls/pair/13/diff_cov.png}\\
					\hline
					2 and
					3&\includegraphics[width=40mm,height=30mm]{naivebayes/ls/pair/23/all_cov.png}&\includegraphics[width=40mm,height=30mm]{naivebayes/ls/pair/23/avg_cov.png}
					&\includegraphics[width=40mm,height=30mm]{naivebayes/ls/pair/23/diff_cov.png}\\
					\hline
				\end{tabular}
				\caption{Decision region plot for every pair of classes}
			\end{figure}

		%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

		\subsubsection{Non-Linearly separable data set }

			\paragraph{Data of Interlocking Classes}

			\noindent

				%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

			\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{naivebayes/nls/interlock/all/all_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with alltogether covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 188	\\
				Incorrect : 187	\\
				Acurracy  : 50.133 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c| }
				\hline
				& & \multicolumn{2}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 46 & 29 \\
				& Class 2 & 158 & 142\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{naivebayes/nls/interlock/all/avg_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with average covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 188	\\
				Incorrect : 187	\\
				Acurracy  : 50.133 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c| }
				\hline
				& & \multicolumn{2}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 46 & 29 \\
				& Class 2 & 158 & 142\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{naivebayes/nls/interlock/all/diff_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with different covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 375	\\
				Incorrect : 0	\\
				Acurracy  : 100 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c| }
				\hline
				& & \multicolumn{2}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 75 & 0 \\
				& Class 2 & 0 & 300\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

				%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

			\paragraph{A ring with a central mass}

			\noindent

				%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

			\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{naivebayes/nls/ring/all/all_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with alltogether covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 188	\\
				Incorrect : 187	\\
				Acurracy  : 50.133 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c| }
				\hline
				& & \multicolumn{2}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 46 & 29 \\
				& Class 2 & 158 & 142\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{naivebayes/nls/ring/all/avg_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with average covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 188	\\
				Incorrect : 187	\\
				Acurracy  : 50.133 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c| }
				\hline
				& & \multicolumn{2}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 46 & 29 \\
				& Class 2 & 158 & 142\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{naivebayes/nls/ring/all/diff_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with different covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 375	\\
				Incorrect : 0	\\
				Acurracy  : 100 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c| }
				\hline
				& & \multicolumn{2}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 75 & 0 \\
				& Class 2 & 0 & 300\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}
				%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

			\paragraph{Spiral Dataset}

			\noindent

		%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

			\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{naivebayes/nls/spiral/all/all_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with alltogether covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 188	\\
				Incorrect : 187	\\
				Acurracy  : 50.133 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c| }
				\hline
				& & \multicolumn{2}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 46 & 29 \\
				& Class 2 & 158 & 142\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{naivebayes/nls/spiral/all/avg_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with average covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 188	\\
				Incorrect : 187	\\
				Acurracy  : 50.133 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c| }
				\hline
				& & \multicolumn{2}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 46 & 29 \\
				& Class 2 & 158 & 142\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{naivebayes/nls/spiral/all/diff_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with different covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 375	\\
				Incorrect : 0	\\
				Acurracy  : 100 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c| }
				\hline
				& & \multicolumn{2}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 75 & 0 \\
				& Class 2 & 0 & 300\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}
				%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

		\subsubsection{Overlapping data set}
			%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

			\begin{figure}
			\begin{tabular}{|c|c|c|c|}
				\hline
				Pair/Cov &  Alltogther & Average & Different	\\
				\hline
				1 and
				2&\includegraphics[width=40mm,height=30mm]{naivebayes/over/pair/12/all_cov.png}&\includegraphics[width=40mm,height=30mm]{naivebayes/over/pair/12/avg_cov.png}
				&\includegraphics[width=40mm,height=30mm]{naivebayes/over/pair/12/diff_cov.png}\\
				\hline
				1 and
				3&\includegraphics[width=40mm,height=30mm]{naivebayes/over/pair/13/all_cov.png}&\includegraphics[width=40mm,height=30mm]{naivebayes/over/pair/13/avg_cov.png}
				&\includegraphics[width=40mm,height=30mm]{naivebayes/over/pair/13/diff_cov.png}\\
				\hline
				1 and
				4&\includegraphics[width=40mm,height=30mm]{naivebayes/over/pair/14/all_cov.png}&\includegraphics[width=40mm,height=30mm]{naivebayes/over/pair/14/avg_cov.png}
				&\includegraphics[width=40mm,height=30mm]{naivebayes/over/pair/14/diff_cov.png}\\
				\hline
				2 and
				3&\includegraphics[width=40mm,height=30mm]{naivebayes/over/pair/23/all_cov.png}&\includegraphics[width=40mm,height=30mm]{naivebayes/over/pair/23/avg_cov.png}
				&\includegraphics[width=40mm,height=30mm]{naivebayes/over/pair/23/diff_cov.png}\\
				\hline
				2 and
				4&\includegraphics[width=40mm,height=30mm]{naivebayes/over/pair/24/all_cov.png}&\includegraphics[width=40mm,height=30mm]{naivebayes/over/pair/24/avg_cov.png}
				&\includegraphics[width=40mm,height=30mm]{naivebayes/over/pair/24/diff_cov.png}\\
				\hline
				3 and
				4&\includegraphics[width=40mm,height=30mm]{naivebayes/over/pair/34/all_cov.png}&\includegraphics[width=40mm,height=30mm]{naivebayes/over/pair/34/avg_cov.png}
				&\includegraphics[width=40mm,height=30mm]{naivebayes/over/pair/34/diff_cov.png}\\
				\hline

			\end{tabular}
			\caption{Decision region plot for every pair of classes}
			\end{figure}

			\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{naivebayes/over/all/all_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with alltogether covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 450	\\
				Incorrect : 50	\\
				Acurracy  : 90.000 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c|c|c| }
				\hline
				& & \multicolumn{4}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2 & Class 3 & Class 4\\
				\hline
				\multirow{4}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1& 111 & 4 & 4 & 6\\
				& Class 2 & 1 & 116 & 0 & 8\\
				& Class 3 & 9 & 0 & 116 & 0\\
				& Class 4 & 6 & 12 & 0 & 107\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{naivebayes/over/all/avg_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with average covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 453	\\
				Incorrect : 47	\\
				Acurracy  : 90.600 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c|c|c| }
				\hline
				& & \multicolumn{4}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2 & Class 3 & Class 4\\
				\hline
				\multirow{4}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1& 111 & 6 & 4 & 4\\
				& Class 2 & 2 & 118 & 0 & 5\\
				& Class 3 &9 & 0 & 116 & 0\\
				& Class 4 & 5 & 12 & 0 & 108\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{naivebayes/over/all/avg_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with different covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 452	\\
				Incorrect : 48	\\
				Acurracy  : 90.400 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c|c|c| }
				\hline
				& & \multicolumn{4}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2 & Class 3 & Class 4\\
				\hline
				\multirow{4}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1& 113 & 4 & 4 & 4\\
				& Class 2 & 2 & 118 & 0 & 5\\
				& Class 3 & 12 & 0 & 113 & 0\\
				& Class 4 & 5 & 12 & 0 & 108\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
		\subsubsection{Real world data set}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			 \includegraphics[width=\textwidth]{naivebayes/real/all/all_cov.png}
		  	\captionof{figure}{ Decision region plot for all the classes together with the training data
superposed with alltogether covariance} % [4]
		  \label{gfx/image}
		\end{minipage}
		\begin{minipage}[t]{0.2\linewidth} % [2]
		\vspace{10pt} % [3]
			Correct   : 374	\\
			Incorrect : 1	\\
			Acurracy  : 99.733 \\
		\begin{center}
			\begin{tabular}{ |c|c|c|c|c| }
			\hline
			& & \multicolumn{3}{| c |}{Predicted} \\
			\hline
			& & Class 1 & Class 2 & Class 3\\
			\hline
			\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 125 & 0 & 0\\
			& Class 2 & 0 & 125 & 0\\
			& Class 3 & 0 & 1 & 124\\
			\hline
			\end{tabular}
			\end{center}
		\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{naivebayes/real/all/avg_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with average covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 374	\\
				Incorrect : 1	\\
				Acurracy  : 99.733 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c|c| }
				\hline
				& & \multicolumn{3}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2 & Class 3\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 125 & 0 & 0\\
				& Class 2 & 0 & 125 & 0\\
				& Class 3 & 0 & 1 & 124\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		\begin{minipage}[t]{0.6\linewidth}
			\vspace{0pt} % [3]
			  \includegraphics[width=\textwidth]{naivebayes/real/all/diff_cov.png}
			  \captionof{figure}{ Decision region plot for all the classes together with the training data
 superposed with different covariance} % [4]
			  \label{gfx/image}
			\end{minipage}
			\begin{minipage}[t]{0.2\linewidth} % [2]
			\vspace{10pt} % [3]
				Correct   : 375	\\
				Incorrect : 0	\\
				Acurracy  : 100 \\
			\begin{center}
				\begin{tabular}{ |c|c|c|c|c| }
				\hline
				& & \multicolumn{3}{| c |}{Predicted} \\
				\hline
				& & Class 1 & Class 2 & Class 3\\
				\hline
				\multirow{3}{*}{\rotatebox[origin=c]{90}{Act.}} & Class 1 & 125 & 0 & 0\\
				& Class 2 & 0 & 125 & 0\\
				& Class 3 & 0 & 0 & 125\\
				\hline
				\end{tabular}
				\end{center}
			\end{minipage}

		%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

			\begin{figure}
				\begin{tabular}{|c|c|c|c|}
					\hline
					Pair/Cov &  Alltogther & Average & Different	\\
					\hline
					1 and
					2&\includegraphics[width=40mm,height=30mm]{naivebayes/real/pair/12/all_cov.png}&\includegraphics[width=40mm,height=30mm]{naivebayes/real/pair/12/avg_cov.png}
					&\includegraphics[width=40mm,height=30mm]{naivebayes/real/pair/12/diff_cov.png}\\
					\hline
					1 and
					3&\includegraphics[width=40mm,height=30mm]{naivebayes/real/pair/13/all_cov.png}&\includegraphics[width=40mm,height=30mm]{naivebayes/real/pair/13/all_cov.png}
					&\includegraphics[width=40mm,height=30mm]{naivebayes/real/pair/13/diff_cov.png}\\
					\hline
					2 and
					3&\includegraphics[width=40mm,height=30mm]{naivebayes/real/pair/23/all_cov.png}&\includegraphics[width=40mm,height=30mm]{naivebayes/real/pair/23/avg_cov.png}
					&\includegraphics[width=40mm,height=30mm]{naivebayes/real/pair/23/diff_cov.png}\\
					\hline
				\end{tabular}
				\caption{Decision region plot for every pair of classes}
			\end{figure}

		%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5

	\subsubsection{Linearly separable data set}
		The decision boundaries are very similar to the bayes classifier, where most
		of test data fit in the estimated class regions.

\section{Conclusion}
	As per the observations, we can make the following conclusions :

	\begin{enumerate}
	  \item The Decision Boundaries are more accurate in the case of different
	  covariance for different classes as compared to the other cases.
	  \item The curvature of the decision boundaries is due to the covariance term
	  in the likelihood probabilty which makes the surface quadratic.
	  \item The Decision Boundaries are better in cases where data is not
	  overlapping and is separable either linearly or non linearly.
	  \item In case of real data, the data is more overlapping and non
	  linear, resulting in lesser accuracy of the testing data.
	\end{enumerate}

\end{document}


\documentclass{memoir}
\usepackage{notestemplate}

%\logo{~/School-Work/Auxiliary-Files/resources/png/logo.png}
%\institute{Rice University}
%\faculty{Faculty of Whatever Sciences}
%\department{Department of Mathematics}
%\title{Class Notes}
%\subtitle{Based on MATH xxx}
%\author{\textit{Author}\\Gabriel \textsc{Gress}}
%\supervisor{Linus \textsc{Torvalds}}
%\context{Well, I was bored...}
%\date{\today}

%\makeindex

\begin{document}

% \maketitle

% Notes taken on 07/14/21

\begin{defn}[Harmonic Functions]
	Let \(u \in C^2(\Omega)\) for \(\Omega\subset \R^{n}\) be a \textit{real-valued} multivariate function with continuous second-derivative. We say that \(u\) is \textbf{harmonic} if it satisfies
	\begin{align*}
		\Delta u := \sum_{i=1}^{n} \frac{\partial^2 u}{\partial x_i^2} = 0.
	\end{align*}
	We call the operator \(\Delta \) the \textbf{Laplacian} and the equation above \textbf{Laplace's equation}.
\end{defn}
Now suppose \(f = (u,v)\) is holomorphic on \(\Omega \subset \C\). We have shown that \(u,v \in C^{\infty}\) and the Cauchy-Riemann equations tell us that
\begin{align*}
	\frac{\partial u}{\partial x} = \frac{\partial v}{\partial y} \\
	\frac{\partial u}{\partial y} = - \frac{\partial v}{\partial x} .
\end{align*}
Applying \(\frac{\partial }{\partial x} \) or \(\frac{\partial }{\partial y} \) to both sides brings us to our first connection between holomorphic and harmonic functions.

\begin{thm}
	Let \(f=(u,v)\) be a holomorphic function. Then \(u,v\) are harmonic.
\end{thm}

Thus, we have seen that holomorphicity already implicitly requires two harmonic functions. But the Cauchy-Riemann equations give us additional structure on \(u,v\):

\begin{defn}[Conjugate Harmonic Function]
	If two harmonic functions \(u,v\) satisfy the Cauchy-Riemann equations
\begin{align*}
	\frac{\partial u}{\partial x} &= \frac{\partial v}{\partial y} \\
	\frac{\partial u}{\partial y} &= - \frac{\partial v}{\partial x}
\end{align*}
	then \(v\) is said to be the \textbf{conjugate harmonic function} of \(u\).
\end{defn}
In fact, the Cauchy-Riemann equations provide us with the most structure we could expect-- a conjugate harmonic function \(v\) is uniquely determined (up to an additive constant). But exercise caution, as harmonic conjugacy is symmetric, not antisymmetric-- if \(v\) is the conjugate harmonic function of \(u\), then \(u\) is the conjugate harmonic function of \(-v\).\\

\begin{anki}
TARGET DECK
Complex Qual::Complex Analysis
START
MathJaxCloze
Text: If two harmonic functions \(u,v\) satisfy {{c1::the Cauchy-Riemann equations
\(\begin{align*}
        	\frac{\partial u}{\partial x} &= \frac{\partial v}{\partial y} \\
        	\frac{\partial u}{\partial y} &= - \frac{\partial v}{\partial x}
        \end{align*}\)}}
	then \(v\) is said to be the **conjugate harmonic function** of \(u\).
Extra: In fact, the Cauchy-Riemann equations provide us with the most structure we could expect-- a conjugate harmonic function \(v\) is uniquely determined (up to an additive constant). But exercise caution, as harmonic conjugacy is symmetric, not antisymmetric-- if \(v\) is the conjugate harmonic function of \(u\), then \(u\) is the conjugate harmonic function of \(-v\).
Tags: analysis complex_analysis complex_analyticity defn
<!--ID: 1624560720227-->
END
\end{anki}

Recall the complex differential forms:
\begin{align*}
	dz = (dx, dy)\\
	d \overline{z} = (dx,-dy)
\end{align*}
defined so that
\begin{align*}
	dx = (\sfrac{1}{2},0) (dz + d \overline{z})\\
	dy = (0, \sfrac{1}{2}) (dz - d \overline{z})
\end{align*}
is satisfied. We also defined the complex differential operator by:
\begin{align*}
	\frac{\partial }{\partial z} &= \frac{1}{2}\left( \frac{\partial }{\partial x} , \frac{\partial }{\partial y}  \right)\\
	\frac{\partial }{\partial \overline{z}} &= \frac{1}{2} \left( \frac{\partial }{\partial x} , - \frac{\partial }{\partial y}  \right)
\end{align*}
defined so that
\begin{align*}
	df = \frac{\partial f}{\partial z} \,d z + \frac{\partial f}{\partial \overline{z}} \,d \overline{z}
\end{align*}
is satisfied.

\begin{prop}
	\begin{align*}
		\Delta = 4 \frac{\partial }{\partial z} \frac{\partial }{\partial \overline{z}} = 4 \frac{\partial }{\partial \overline{z}} \frac{\partial }{\partial z} .
	\end{align*}
\end{prop}
This follows directly from computations.\\

\begin{anki}
START
MathJaxCloze
Text: Consider the complex differential forms:
\(\begin{align*}
  	dz &= (dx,dy) & \quad dx &= (\sfrac{1}{2},0)(dz + d\overline{z}) \\
  	d \overline{z} &= (dx,-dy) &\quad \,d y &= (0,\sfrac{1}{2})(dz - d \overline{z})
  \end{align*}\)
  and the corresponding operators
  \(\begin{align*}
    	\frac{\partial }{\partial z} &= \frac{1}{2}\left( \frac{\partial }{\partial x} , \frac{\partial }{\partial y}  \right)\\
    	\frac{\partial }{\partial \overline{z}} &= \frac{1}{2} \left( \frac{\partial }{\partial x} , - \frac{\partial }{\partial y}  \right)
    \end{align*}\). Then we can write the Laplacian operator by:
    {{c1::\(\begin{align*}
	    	\Delta = 4 \frac{\partial }{\partial z} \frac{\partial }{\partial \overline{z}} = 4 \frac{\partial }{\partial \overline{z}} \frac{\partial }{\partial z} .
	    \end{align*}\)}}
Tags: analysis complex_analysis harmonic_functions
<!--ID: 1626993604616-->
END
\end{anki}

Recall from real analysis that a harmonic function is defined by its value on the boundary:
\begin{thm}
	Let \(U\subset \R^n\) be a bounded open set. Let \(u:\overline{U}\to \R^{n}\) be a continuous function harmonic on \(U\). Suppose there exists a second continuous function \(v:\overline{U}\to \R^{n}\) harmonic on \(U\), so that \(u = v\) on \(\partial U\). Then \(u=v\) on \(\overline{U}\).
\end{thm}
This theorem has two main weaknesses. The first is that the set is required to be bounded. The second is that the functions must be continuous on the boundary.\\

Complex analysis provides us with tools that can resolve these weaknesses. The Riemann mapping theorem allows us to obtain an isomorphism from most unbounded sets into a bounded region-- although we must be cautious that the boundary curves correspond to each other properly. We will need to build more theory to handle discontinuities on the boundary.\\

One can show that if \(u\) is \textit{bounded everywhere on \(\partial U\)} and continuous on \(\partial U\)-- except for a finite number of points, then the theorem holds as expected. We omit the proof here.\\

\begin{anki}
START
MathJaxCloze
Text: Let \(U\subset \R^n\) be a bounded open set. Let \(u:\overline{U}\to \R^{n}\) be a continuous function harmonic on \(U\). Suppose there exists a second continuous function \(v:\overline{U}\to \R^{n}\) harmonic on \(U\), so that \(u = v\) on \(\partial U\). Then \(u=v\) on \(\overline{U}\).
Extra: If \(u\) is \textit{bounded everywhere on \(\partial U\)} and continuous on \(\partial U\)-- except for a finite number of points, then the theorem holds as expected.
Tags: analysis complex_analysis harmonic_functions
<!--ID: 1626993604635-->
END
\end{anki}

Recall that we can compute the complex derivative of a function \(f=(u,v)\) directly by
\begin{align*}
	f'(z) = 2 \frac{\partial u}{\partial z} .
\end{align*}
We have a converse provided that the underlying space is simply connected.
 \begin{prop}
	 Let \(\Omega \subset \C\) be a simply connected set, and let \(u\) be a real-valued harmonic function on \(U\). Then there exists a holomorphic function \(f \in \textrm{Hol}(\Omega )\) so that \(u= \textrm{Re}(f)\). Furthermore, this holomorphic function is unique up to an imaginary constant.
\end{prop}
To see that simply connectedness is necessary, consider \(\ln(\left| z \right| )\) on \(D_1 \setminus\left\{ 0 \right\} \).
\begin{anki}
START
MathJaxCloze
Text: Let \(\Omega \subset \C\) be a simply connected set, and let \(u\) be a real-valued harmonic function on \(U\). Then there exists a holomorphic function \(f \in \textrm{Hol}(\Omega )\) so that {{c1::\(u= \textrm{Re}(f)\)}}. Furthermore, this holomorphic function is {{c1::unique up to an imaginary constant}}.
Extra: To see that simply connectedness is necessary, consider \(\ln(\left| z \right| )\) on \(D_1 \setminus\left\{ 0 \right\} \).
Tags: analysis complex_analysis harmonic_functions
<!--ID: 1626993604652-->
END
\end{anki}
Uniqueness will follow from a slightly more general lemma:
\begin{lemma}
	Let \(\Omega \subset \C\) be a connected open set, and \(f,g\) holomorphic functions on \(\Omega \). If \(\textrm{Re}(f) = \textrm{Re}(g)\), then
	\begin{align*}
		f = (g, K)
	\end{align*}
	for some constant \(K \in \R\).
\end{lemma}

\begin{anki}
START
MathJaxCloze
Text: Let \(\Omega \subset \C\) be a connected open set, and \(f,g\) holomorphic functions on \(\Omega \). If \(\textrm{Re}(f) = \textrm{Re}(g)\), then
\(\begin{align*}
  	f = (g, K)
  \end{align*}\)
for some constant \(K \in \R\).
Tags: analysis complex_analysis complex_analyticity
<!--ID: 1626993604668-->
END
\end{anki}

We will need some simple properties of composition, which we give now as an exercise.
\begin{hw}
	Let \(f:U\to V\) be a holomorphic function. Suppose \(g\) is harmonic on \(V\). Then \(g\circ f \) is harmonic on \(U\).\\

	Suppose instead that \(g\) is harmonic on the set
	\begin{align*}
		V' = \left\{ \overline{z} \mid z \in V \right\} .
	\end{align*}
	Then the function
	\begin{align*}
		g(\overline{f(z)})
	\end{align*}
	is harmonic on \(U\).
\end{hw}

Now we prove the mean value theorem for harmonic functions via Cauchy's theorem.
\begin{thm}[Mean Value Theorem]
	Let \(\Omega \subset \C\) be an open set and \(u\) a harmonic function on \(\Omega \). Let \(z_0 \in U\) be given and consider \(\overline{D_r(z_0)}\subset \Omega \) for some \(r>0\) sufficiently small. Then
	\begin{align*}
		u(z_0) = \frac{1}{2\pi } \int_{0}^{2\pi } u(z_0+re^{i\theta }) \,d \theta .
	\end{align*}
\end{thm}
Naturally, the maximum principle for harmonic functions falls out from this.

\begin{anki}
START
MathJaxCloze
Text: **Mean Value Theorem for Harmonic Functions**
Let \(\Omega \subset \C\) be an open set and \(u\) a harmonic function on \(\Omega \). Let \(z_0 \in U\) be given and consider \(\overline{D_r(z_0)}\subset \Omega \) for some \(r>0\) sufficiently small. Then
 {{c1::\(\begin{align*}
         	u(z_0) = \frac{1}{2\pi } \int_{0}^{2\pi } u(z_0+re^{i\theta }) \,d \theta .
         \end{align*}\)}}
Tags: analysis complex_analysis harmonic_functions
<!--ID: 1626993604684-->
END
\end{anki}

\begin{thm}[Maximum Principle of Harmonic Functions]
	Let \(\Omega \subset \C\) be a connected open set with \(u\) harmonic on \(\Omega \).
\begin{itemize}
	\item If \(u\) has a maximum at a point \(z_0 \in \Omega \), then \(u\) is constant.
	\item If \(u\) is continuous on \(\overline{\Omega }\) and not constant on \(U\), then \(u\) obtains its maximum on \(\partial U\).
\end{itemize}
\end{thm}

We can apply the maximum modulus principle in a lot of non-intuitive circumstances. In fact, the maximum modulus is not arbitrary-- we can bound the maximum modulus on a circle provided we have information on the maximum modulus of \(f\) on concentric circles near it.

\begin{anki}
START
MathJaxCloze
Text: **Maximum Principle of Harmonic Functions**
Let \(\Omega \subset \C\) be a connected open set with \(u\) harmonic on \(\Omega \).

* If \(u\) has a maximum at a point \(z_0 \in \Omega \), then {{c1::\(u\) is constant}}.
* If \(u\) is continuous on \(\overline{\Omega }\) and not constant on \(U\), then {{c1::\(u\) obtains its maximum on \(\partial U\)}}.
Tags: analysis complex_analysis harmonic_functions
<!--ID: 1626993604707-->
END
\end{anki}

\begin{thm}[Hadamard's Three-Circle Theorem]
	Let \(0<R_1<R_2<\infty\) be given and consider the annulus given by \(\Omega = D_{R_2} \setminus \overline{D_{R_1}}\). Let
	\begin{align*}
		\prescript{}{r}\|f\|_\infty := \textrm{max}_{z \in \partial D_r} \left| f(z) \right| .
	\end{align*}
	If a function \(f\) is holomorphic on the open annulus and continuous on the closure of the annulus, then
	\begin{align*}
		\prescript{}{r}\|f\|_{\infty} &\leq \prescript{}{R_1}\|f\|_{\infty}^{\alpha } \prescript{}{R_2}\|f\|_{\infty}^{1-\alpha }\\
		\alpha &= \frac{\ln(\sfrac{R_2}{r})}{\ln(\sfrac{R_2}{R_1})}.
	\end{align*}
	In other words, the maximum modulus of \(f\) on a circle \(\partial D_r\) is bounded by a logarithmic interpolation between the maximum modulus of \(f\) on concentric circles surrounding \(\partial D_r\).
\end{thm}

\begin{anki}
START
MathJaxCloze
Text: **Hadamard's Three-Circle Theorem**
Let \(0<R_1<R_2<\infty\) be given and consider the annulus given by \(\Omega = D_{R_2} \setminus \overline{D_{R_1}}\). Let
\(\begin{align*}
  	\prescript{}{r}\|f\|_\infty := \textrm{max}_{z \in \partial D_r} \left| f(z) \right| .
  \end{align*}\)
If a function \(f\) is holomorphic on the open annulus and continuous on the closure of the annulus, then
{{c1::\(\begin{align*}
      	\prescript{}{r}\|f\|_{\infty} &\leq \prescript{}{R_1}\|f\|_{\infty}^{\alpha } \prescript{}{R_2}\|f\|_{\infty}^{1-\alpha }\\
      	\alpha &= \frac{\ln(\sfrac{R_2}{r})}{\ln(\sfrac{R_2}{R_1})}.
        \end{align*}\)}}
In other words, the maximum modulus of \(f\) on a circle \(\partial D_r\) is {{c1::bounded by a logarithmic interpolation}} between the {{c1::maximum modulus of \(f\) on concentric circles surrounding \(\partial D_r\)}}.
Tags: analysis complex_analysis harmonic_functions
<!--ID: 1626993604724-->
END
\end{anki}

\subsection{Harmonic Functions on Annuli}
\label{sub:harmonic_functions_on_annuli}

The annulus is an interesting case because it is not simply connected, and hence we cannot utilize our previous theorems to induce a holomorphic function. However, it has plenty of structure that allows us to induce the holomorphic function a different way.

\begin{thm}[Correspondence Between Harmonic and Holomorphic Functions (Annulus)]
	Let \(0\leq R_1<R_2\) be given and consider the annulus given by \(\Omega = D_{R_2}\setminus \overline{D_{R_1}}\). Suppose \(u\) is a harmonic function on \(\Omega \). Then there exists a constant \(a \in \R\) and a holomorphic function \(f \in \textrm{Hol}(\Omega )\) such that
	\begin{align*}
		\textrm{Re}(f) = u - a \ln(\left| z \right| ).
	\end{align*}
\end{thm}
Note that we allow \(R_1=0\) or \(R_2=\infty\) to include the special cases of the punctured plane \(\C\setminus\left\{ 0 \right\} \) and the punctured disk \(D_1\setminus\left\{ 0 \right\} \).

\begin{proof}

\end{proof}

\begin{anki}
START
MathJaxCloze
Text: **Correspondence between Harmonic and Holomorphic on the Annulus**
Let \(0\leq R_1<R_2\) be given and consider the annulus given by \(\Omega = D_{R_2}\setminus \overline{D_{R_1}}\). Suppose \(u\) is a harmonic function on \(\Omega \). Then there exists a constant \(a \in \R\) and a holomorphic function \(f \in \textrm{Hol}(\Omega )\) such that
{{c1::\(\begin{align*}
        	\textrm{Re}(f) = u - a \ln(\left| z \right| ).
        \end{align*}\)::real part of f}}
Extra: Note that we allow \(R_1=0\) or \(R_2=\infty\) to include the special cases of the punctured plane \(\C\setminus\left\{ 0 \right\} \) and the punctured disk \(D_1\setminus\left\{ 0 \right\} \).
This also gives us a simple way to compute integrals of harmonic functions on the annulus:
\(\begin{align*}
  	\frac{1}{2\pi }\int_{0}^{2\pi } u(r,\theta )\,d \theta  = a \ln(\left| z \right| ) + b.
  \end{align*}\)
Tags: analysis complex_analysis harmonic_functions
<!--ID: 1626993604740-->
END
\end{anki}

This also gives us a simple way to compute integrals of harmonic functions on the annulus:
\begin{cor}
	Let \(0\leq R_1<R_2\) be given and consider the annulus given by \(\Omega  = D_{R_2}\setminus\left\{ D_{R_1} \right\} \). Let \(u\) be harmonic on \(\Omega \). Then there exists constants \(a,b\in \C\) so that
	\begin{align*}
		\frac{1}{2\pi }\int_{0}^{2\pi } u(r,\theta )\,d \theta  = a \ln(\left| z \right| ) + b.
	\end{align*}
\end{cor}

Nevertheless, it will continue to prove difficult to unify our study of harmonic and holomorphic functions until we can find conditions under which we can extend harmonic functions on a domain that is not simply connected. We will prove a result that we will use to extend to the general case.
\begin{lemma}[Extension of Bounded Harmonic Functions]
	Let \(\Omega = D_1\setminus\left\{ 0 \right\} \) be the punctured disc and suppose that \(u\) is a bounded harmonic function on \(\Omega \). Then \(u\) extends to a harmonic function on \(D_1\).
\end{lemma}

This gives us hope that harmonic functions can extend on removable singularities, but first we will need one more lemma.

\begin{lemma}[Analytic Continuation for Harmonic Functions]
	Let \(\Omega \subset \C\) be a connected open set. Suppose \(u\) is a harmonic function on \(\Omega \) and \(f\) a holomorphic function on \(\Omega \). If \(u = \textrm{Re}(f)\) on some \(D_r\subset \Omega \) for \(r>0\), then \(u = \textrm{Re}(f)\) everywhere in \(\Omega \).
\end{lemma}

Finally, we obtain the desired result:
\begin{thm}[Correspondence Between Harmonic and Holomorphic Functions (General)]
	Let \(\Omega\subset \C \) be a simply connected open set, and let \(\left\{ z_i \right\}_{i=1}^{n}\) be a sequence of distinct points in \(\Omega \). Consider \(\Omega^{*}= \Omega \setminus] \left\{ z_i \right\}_{i=1}^{n}\), and let \(u\) be a real harmonic function on \(\Omega ^{*}\). Then there exists constants \(\left\{ a_i \right\}_{i=1}^{n}\subset \C\) and a holomorphic function \(f \in \textrm{Hol}(\Omega^{*})\) such that, for all \(z \in \Omega^{*}\),
	\begin{align*}
		\textrm{Re}(f(z)) = u(z) - \sum_{i=1}^{n} a_i \ln \left| z-z_i \right| .
	\end{align*}
\end{thm}
In fact, we can actually consider deleted discs \(D_{r_i}(z_i)\) and obtain the same result, in which case our theorem on the annulus is a special case of the above theorem.

\begin{anki}
START
MathJaxCloze
Text: Let \(\Omega\subset \C \) be a simply connected open set, and let \(\left\{ z_i \right\}_{i=1}^{n}\) be a sequence of distinct points in \(\Omega \). Consider \(\Omega^{*}= \Omega \setminus] \left\{ z_i \right\}_{i=1}^{n}\), and let \(u\) be a real harmonic function on \(\Omega ^{*}\). Then there exists constants \(\left\{ a_i \right\}_{i=1}^{n}\subset \C\) and a holomorphic function \(f \in \textrm{Hol}(\Omega^{*})\) such that, for all \(z \in \Omega^{*}\),
\(\begin{align*}
  	\textrm{Re}(f(z)) = u(z) - \sum_{i=1}^{n} a_i \ln \left| z-z_i \right| .
  \end{align*}\)
Extra: We can actually consider deleted discs \(D_{r_i}(z_i)\) and obtain the same result, in which case our theorem on the annulus is a special case of the above theorem.
Tags: analysis complex_analysis harmonic_functions
<!--ID: 1626993604756-->
END
\end{anki}

\begin{proof}

\end{proof}

%\subsection{Poisson Formula}
%\label{sub:poisson_formula}

%\subsection{Construction of Harmonic Functions}
%\label{sub:construction_of_harmonic_functions}

% \printindex
\end{document}


\section*{Types of States}
\subsection*{Pure State (1 or more systems)}
A pure state can describe a single or multiple quantum systems.
\begin{itemize}
\item [$\ket{\psi_{\text{pure}}}$:] known exactly
\item [$\ket{\psi_{\text{pure}}} = \ket{\psi_1}\otimes\ket{\psi_2}\otimes
  \dotsm \otimes \ket{\psi_n}$:] all constituent systems can be factored
\item [$\rho_{\text{pure}} \equiv \outerproduct{\psi_{\text{pure}}}$:] density operator is outer product
\item [$\trace(\rho_{\text{pure}}^2) = 1$:] unity trace of squared density operator
\end{itemize}

\subsection*{Mixed State (1 or more systems)}
\begin{itemize}
\item [$\rho_{\text{mixed}} = \sum_i p_i\outerproduct{\psi_i}$:]
  \emph{statistical} combination, not exactly known
\item [$\trace(\rho_{\text{mixed}}^2) < 1$:] less than unity trace of squared density operator
\end{itemize}

\subsection*{Entangled State (2 or more systems)}
\begin{itemize}
\item [$\ket{\psi_{\text{entangled}}}$:] \emph{joint} system is exactly
  known
\item [$\ket{\psi_{\text{entangled}}} \neq \ket{\psi_1}\otimes\ket{\psi_2}\otimes
  \dotsm \otimes \ket{\psi_n}$:] constituent systems \emph{cannot} be factored
\item [$\trace(\rho_{\text{entangled}}^2) = 1$:] unity trace of squared
  density operator for \emph{joint} system
\item [$\rho_{\text{entangled}} \equiv
  \outerproduct{\psi_{\text{entangled}}}$:] density operator is outer
  product
\item [$\rho_{\text{entangled}}^A = \trace_B(\rho_{\text{entangled}}^{AB})$:]
      susbsystem $A$ obtained via \emph{partial trace} over subsystem $B$
\item [$\trace_A([{\rho_{\text{entangled}}^A]^2}) < 1$:] less than unity trace of
  squared density operator for \emph{subsystem}
  \begin{itemize}
  \item Subsystem is in a \emph{mixed} state whereas the full system is a
    \emph{pure} state --- fingerprint of entanglement
  \end{itemize}
\end{itemize}


\documentclass[11pt,a4paper]{report}
\usepackage{amsmath,amsfonts,amssymb,amsthm,epsfig,epstopdf,titling,url,array}
\usepackage{enumitem}
\usepackage{changepage}
\usepackage{graphicx}
\usepackage{caption}
\theoremstyle{plain}
\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
\newtheorem*{cor}{Corollary}
\theoremstyle{definition}
\newtheorem{defn}{Definition}[section]
\newtheorem{conj}{Conjecture}[section]
\newtheorem{exmp}{Example}[section]
\newtheorem{exercise}{Exercise}[section]
\theoremstyle{remark}
\newtheorem*{rem}{Remark}
\newtheorem*{note}{Note}
\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist
\begin{document}

\section*{Problem}
\begin{enumerate}[label=(\alph*)]
\item {Suppose that in the picture below, the triangle is equilateral and the circle has radius 1. Find the length of a side of the triangle.
\begin{figure}[h!]
  \includegraphics[width=2in]{triangle.png}
  {\caption*{}}
  \label{}
\end{figure}}
\end{enumerate}
\section*{Bonus}
\begin{enumerate}[label=(\alph*)]\addtocounter{enumi}{1}
\item Generalize your solution to derive a formula
for $s(n)$ = the length of a side of an
$n$-sided regular polygon inscribed in the unit circle.
\item Find $lim_{n\to\infty}s(n)$
\item Find $lim_{n\to\infty}p(n) = ns(n)$
\item Explain why the limits in parts $c$ and $d$
 make sense.
\end{enumerate}

\newpage
\section*{Solution (part a)}
Rotate the original diagram clockwise by $\pi/2$ radians and set up
a coordinate system as shown in the picture below.

\begin{figure}[h!]
  \includegraphics[width=3in]{triangle2.png}
  {\caption*{}}
  \label{}
\end{figure}

Since all angles of the triangle are the same, the arc length of each of
the three arcs that the triangle cuts the unit circle into is $2\pi/3$. So the coordinates of the vertex in the second quadrant must be
$\big(cos(2\pi/3), sin(2\pi/3)\big)$ or $(-1/2,\sqrt{3}/2).$  We can find the length of the side from the vertex on the $x$ axis to this point using the distance formula:
$$\sqrt{(-1/2 - 1)^2 + (\sqrt{3}/2 - 0)^2} = \sqrt{3}$$

\section*{(part b)}
Using the same argument as in part a), an $n$-sided polygon will cut the circle into $n$ arcs, each of size $2\pi/n$ radians.  The side along the first arc moving counter-clockwise along the unit circle from the $x$-axis will have the following length, again using the distance formula:
$$s(n) = \sqrt{(cos(2\pi/n) - 1)^2 + (sin(2\pi/n) - 0)^2}$$

\section*{(part c)}
As $n \to \infty$, $cos(2\pi/n) \to cos(0) = 1$ and $sin(2\pi/n) \to sin(0) = 0$, so $s(n) \to \sqrt{ (1 - 1)^2 - (0 - 0)^2} = 0$.

\section*{(part d)}
This one is a little trickier.  Note that $p(n)$ is the perimeter of the inscribed polygon.  Intuitively, this should converge on the circumference of the circle, which is $2\pi$.  Of course, mathematics does not fail us here.
$$lim_{n\to\infty}p(n) = $$
$$lim_{n\to\infty} n\sqrt{(cos(2\pi/n) - 1)^2 + (sin(2\pi/n) - 0)^2} = $$
OK, this is sneaky (move $n$ under the radical and multiply and divide by $2\pi$)
$$lim_{n\to\infty}2\pi\sqrt{\frac{n^2(cos(2\pi/n) - 1)^2 + n^2(sin(2\pi/n))^2}{ (2\pi)^2}} = $$
$$lim_{n\to\infty}2\pi\sqrt{\frac{n^2(cos(2\pi/n) - 1)^2}{(2\pi)^2} + \frac{n^2(sin(2\pi/n))^2}{(2\pi)^2}} = $$
$$lim_{n\to\infty}2\pi\sqrt{\frac{(cos(2\pi/n) - 1)^2}{(2\pi/n)^2} + \frac{(sin(2\pi/n))^2}{(2\pi/n)^2}} = $$
$$ lim_{n\to\infty}2\pi\sqrt{\Big(\frac{(cos(2\pi/n) - 1)}{(2\pi/n)}\Big)^2 + \Big(\frac{(sin(2\pi/n))}{(2\pi/n)}\Big)^2}.$$

Now, by L'Hospital's rule (see below), $\lim_{x\to 0}\frac{cos(x) - 1}{x} = \lim_{x\to 0}\frac{-sin(x)}{1} = 0$ and $\lim_{x\to 0}sin(x)/x = \lim_{x\to 0}cos(x)/1 = 1$. As ${n\to\infty}$, $2\pi/n\to 0$, so the quantity under the radical in the last expression above approaches $0^2 + 1^2 = 1$.  That makes the entire limit equal to $2\pi$.

\section*{(part e)}
As $n \to \infty$, the inscribed polygon approaches the circle, so as noted in the solution to d), it makes sense that its perimeter approaches the circumference of the circle.  The length, $s(n)$, of a single side has to go to $0$ because the sides all have the same length and for each $n$, $p(n) = ns(n)$ is finite, actually bounded above by $2\pi$ (another nice exercise to prove - hint: shortest distance between two points is a straight line).

\pagebreak
\section*{L'Hospital's Rule}
The form of L'Hospital's rule that we use above is this: \\\\
Suppose that $f$ and $g$ are continuously differentiable throughout an open interval containing the point $c$ in its interior.  Suppose further that $f(c) = g(c) = 0$ and that $\mathop{\lim}\limits_{x\to c}\frac{f'(x)}{g'(x)}$ exists.  Then
$$\mathop{\lim}\limits_{x\to c}\frac{f(x)}{g(x)} = \mathop{\lim}\limits_{x\to c}\frac{f'(x)}{g'(x)}$$
The proof of this form of the rule follows directly from the definition of the derivative:
Recall that the derivative of $f$ at $x$ is defined by
$$f'(x) = \lim_{h \to 0} \frac{f(x + h) - f(x)}{h}.$$
So $$\frac{f'(c)}{g'(c)} = $$
$$\frac{\mathop{\lim}\limits_{h \to 0} \frac {f(c + h) - f(c)} {h}} {\mathop{\lim}\limits_{h \to 0} \frac {g(c + h) - g(c)} {h}} = $$
$$\lim_{h \to 0} \frac {f(c + h) - f(c)} {g(c + h) - g(c)} = $$
$$\lim_{h \to 0} \frac {f(c + h)} {g(c + h)} = $$
$$\lim_{x \to c} \frac {f(x)} {g(x)}.$$
Now since our assumption is that $f'$ and $g'$ are continuous, it follows that
$$\mathop{\lim}\limits_{x\to c}\frac{f'(x)}{g'(x)} = \frac{f'(c)}{g'(c)}$$,so we have shown that
$$\mathop{\lim}\limits_{x\to c}\frac{f(x)}{g(x)} = \mathop{\lim}\limits_{x\to c}\frac{f'(x)}{g'(x)}.$$$$\lim_{h \to 0} \frac {f(c + h)} {g(c + h)}
\end{document}


% Fact sheet for MATH 300, for Fall 2014.
%
\documentclass[12pt]{article}
% Nice page size.
\setlength{\textwidth}{7in} \setlength{\textheight}{9.8in}
\setlength{\topmargin}{-1in} \setlength{\oddsidemargin}{-0.25in}
\setlength{\evensidemargin}{-0.25in}
%
% No page numbering.
\pagestyle{empty}
\usepackage{graphicx}
\usepackage{epstopdf}
\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}
\usepackage{color}
\usepackage{hyperref}
\usepackage{amssymb}
\usepackage{algpseudocode}
\begin{document}
\thispagestyle{empty}
\includegraphics{../../../psulogo_horiz_bw.eps}\hfill\includegraphics{../../../deptlogo}
\vspace{10pt}
\begin{center}
{\large\bf STAT 671}    \\*[5pt] {\Large Statistical Learning I}
\\*[12pt] {\large Fall 2019}
\\ {\large Homework 1}
\\ {\large Due October 14$^{th}$ at the beginning of class}
\end{center}
\vspace{1cm}
\noindent

\section{A simple classifier}
\begin{enumerate}
\item Finish the derivation of the simple classifier provided in class.
\item A code in R for this classifier is provided in D2L. Modify this code, or write your own in the language of your choice such that you can compute a classifier for the Iris data.  The Iris dataset is described and is also available at \url{ https://en.wikipedia.org/wiki/Iris_flower_data_set}. Create a classifier for the labels \lq\lq{}I. setosa\rq\rq{} versus \lq\lq{}I. versicolor\rq\rq{} using 80\% of the data.
compute the classification error using the 20\% remaining. Then, repeat the same thing for the labels \lq\lq{}I. virginica\rq\rq{} versus \lq\lq{}I. versicolor\rq\rq{}. Report your results in a clear and concise form.
\end{enumerate}
 \section{Perceptron}
Consider a training set $\{(x_1,y_1),\ldots,(x_n,y_n)\}$, with $x_i \in \mathbb{R}^d$ and $y_i \in {-1,1}$. The perceptron is one of the oldest algorithm in machine learning. Historical notes are provide at \url{https://en.wikipedia.org/wiki/Perceptron}.
The perceptron is a linear classifier $f(x)=w^Tx$ where $w \in \mathbb{R}^d$.
The algorithm for computing w is as follows:
\begin{algorithmic}
\State Init: $w \leftarrow y_1x_1$
\For{$i=2 \ldots n$}
\If{$y_i w^Tx_i < 0$} $w \leftarrow w + y_ix_i$
\EndIf
\EndFor
\end{algorithmic}
\begin{enumerate}
\item Write the kernalized perceptron algorithm. Hint: assume that the kernalized perceptron classifier can be written as
$$f(x) =\sum_{i=1}^n \alpha_i <\phi(x_i),\phi(x)>$$
for some function $\phi$ and that the algorithm above corresponds to the situation when  $\phi$ is the identity function and $<.,.>$ is the usual  inner product in $\mathbb{R}^d$. Initialize with $\alpha_1=\ldots=\alpha_n=0$. Provide a pseudo-code.
\item Write the code for data in 2 dimensions, similarly than for the simple classifier. Show 3 examples using 3 different kernels.
\end{enumerate}
\section{Kernels over $\mathcal{X}=\mathbb{R}^2$}
Let $x=(x_1,x_2) \in \mathbb{R}^2$ and $y=(y_1,y_2) \in \mathbb{R}^2$,
\begin{enumerate}
\item Let
$$\phi(x)=(x_1^2,\sqrt{2}x_1x_2,x_2^2)$$
Verify that $\phi(x)^T\phi(y) = (x^Ty)^2$
\item Find a function $\phi(x)$:$\mathbb{R}^2 \mapsto \mathbb{R}^6$ such that for any $(x,y)$, $\phi(x)^T\phi(y) = (x^Ty+1)^2$
\item Find a function $\phi(x)$:$\mathbb{R}^2 \mapsto \mathbb{R}^9$ such that for any $(x,y)$, $\phi(x)^T\phi(y) = (x^Ty+1)^2$
\item Verify that $$K(x,y)=(1+x^Ty)^d$$ for $d=1,2\ldots$ is a positive definite kernel
\item Can you find a function $\phi$:$\mathbb{R}^2 \mapsto H$, where $H$ is an inner product space such that for any $(x,y)$, $<\phi(x),\phi(y)>_H = x^Ty -1$?
\end{enumerate}

\end{document}


%============================================================================
% ATOMIC STRUCTURE DEFINITIONS AND CONSTANTS
%============================================================================

This section describes the atomic structure information required for the form
factor calculations such as physical constants, definitions, atomic energy
levels and atomic wave functions.

%============================================================================
% CONSTANTS
%============================================================================
\section{Constants and Definitions}
We first need to define the usual symbols which are common in atomic physics.
\begin{center}
\begin{tabular}{|c|l|} \hline
    Symbol                  &   Meaning                     \\ \hline \hline
    $c$                     &   Speed Of Light              \\
    $e$                     &   Electron Charge             \\
    $m$                     &   Electron Mass               \\
    $a_0$                   &   Bohr Radius                 \\
    $\alpha$                &   Fine Structure Constant     \\
    $\hbar$                 &   Planck's Constant/$2\pi$    \\
    $r_0$                   &   Classical Electron Radius   \\
    $Z$                     &   Atomic Number               \\
    $Y_{lm}(\theta,\phi)$   &   Spherical Harmonics         \\
    \hline
\end{tabular}
\end{center}
We will use $\mb{k} = (k_x,k_y,k_z)$ to represent the photon wave propagation
vector, and in the case of photoionisation, we will use $\mb{k'} =
(k'_x,k'_y,k'_z)$ for the wave-vector of the ejected electron.
Electronic coordinates with respect to the nucleus will be denoted by
$\mb{r} = (r,\theta,\phi)$ whereas the ejection angles of a photo-electron will
be denoted by $\Omega = (\Theta,\Phi)$.
In order to avoid confusion with the fine structure constant $\alpha$,
the Dirac alpha matrix will be denoted by $\Alpha$ where
\begin{equation}
    \Alpha =
    \left(
        \begin{array}{cc}
            0                           &   \mbox{\boldmath $\sigma$} \\
            \mbox{\boldmath $\sigma$}   &   0
        \end{array}
    \right)
\end{equation}
and where $\mbox{\boldmath $\sigma$}$ are the Pauli spin matrices.

When dealing with four component spinors the following definitions have been
adopted.
\begin{itemize}
    \item $\ket{i}$ denotes the $i^{\mathrm{th}}$ state of an atom. For example,
          $\ket{0}$ denotes the ground state, $\ket{1}$ denotes the first
          excited state etc. $\ket{c}$ denotes the continuum or free electron
          state. The state $\ket{i}$ may also be written as $\psi_i$.
    \item $\psi_{ij}$ denotes the $j^{\mathrm{th}}$ component of the
          $i^{\mathrm{th}}$ atomic state.
    \item $g_i(r)$ and $h_i(r)$ denote the radial components of the $i^{\mathrm{th}}$
          atomic state.
    \item $A_{ij}(\theta,\phi)$ denotes the $j^{\mathrm{th}}$ angular component of the
          $i^{\mathrm{th}}$ atomic state.

\end{itemize}
\begin{equation}
    \begin{array}{cc}
        \gamma_1 = \sqrt{1 - (\alpha Z)^2} &  \gamma_2 = \sqrt{4 - (\alpha Z)^2}
    \end{array}
\end{equation}
\begin{equation}
    \begin{array}{cccc}
        N_1 = 1 ;& N_2 = \sqrt{2(1 + \gamma_1)} ;& N_3 = 2
        ;&
        \sigma_1 = \left( \frac{2Z}{N_1 a_0} \right)
    \end{array}
\end{equation}
\begin{equation}
    \begin{array}{ccc}
        \epsilon_1 =
            \left[
                1 + \left( \frac{\alpha Z}{\gamma_1} \right)^2
            \right]^{-1/2}
        &
        \epsilon_2 =
            \left[
                1 + \left( \frac{\alpha Z}{1+\gamma_1} \right)^2
            \right]^{-1/2}
        &
        \epsilon_3 =
            \left[
                1 + \left( \frac{\alpha Z}{\gamma_2} \right)^2
            \right]^{-1/2}
    \end{array}
\end{equation}

%============================================================================
% SCHRODINGER EQUATION
%============================================================================
\section{The Schr\"odinger Equation and Non Relativistic Wave-functions}
    The Schr\"odinger equation for an electron in a Coulomb potential describes
    the non relativistic structure of a hydrogen atom.
    Ignoring fine structure corrections, the equation can be written as:
    \begin{equation}
        \left[
            -\frac{\hbar^2}{2m} \nabla^2 - \frac{Ze}{r}
        \right] \psi(\mb{r}) = E \psi(\mb{r})
    \end{equation}
    Solutions to this equation~\cite{Bransden-Joachain} give the energy levels
    of the hydrogen atom as a function of the principal quantum number $n$
    \begin{equation}
        E_n = - \frac{e^2}{4\pi\epsilon_0 a_0} \frac{Z^2}{2n^2}
    \end{equation}
    and wave functions as a function of the three space variables
    $r$, $\theta$ and $\phi$ and the three quantum numbers $n$,$l$ and $m$.
    \begin{equation}
        \psi_{nlm}(r,\theta,\phi) = R_{nl}(r) Y_{lm}(\theta,\phi)
        =
        - \sqrt{
            \left(
                \frac{2Z}{n a_0}
            \right)^3
            \frac{(n - l - 1)!}{2n [(n+l)!]^3}
        }
        e^{-\rho/2} \rho^l L^{2l+1}_{n+l}(\rho) Y_{lm}(\theta,\phi)
    \end{equation}
    where $\rho = 2Zr/na_0$, $a_0 = 4\pi\epsilon_0\hbar^2 / e^2 m$,
    $Y_{lm}(\theta,\phi)$ are the spherical harmonics and
    $L^{2l+1}_{n+l}(\rho)$ are the associated Laguerre
    polynomials~\cite{Bransden-Joachain}.

    For example, the ground state wave-function of hydrogen
    ($\psi_{1s}$ or $\psi_{100}$) is defined as:
   	\begin{equation} \label{eq:schrodinger-ground}
		\psi_{1s}(r,\theta,\phi) = \frac{1}{\sqrt{\pi}}
								   \left( \frac{Z}{a_0} \right)^{3/2}
								   e^{-Zr/a_0} .
	\end{equation}

%============================================================================
% DIRAC EQUATION
%============================================================================
\section{The Dirac Equation and Relativistic Wave-functions}
    In order to obtain more accurate energy levels and wave-functions for
    hydrogen, the effects of special relativity which give rise to the fine
    structure in the hydrogen spectrum need to be considered. and as such
    the solutions to the Dirac equation for an electron in a central coulombic
    field need to be used.
    The Dirac equation is shown here (where $\psi$ is a four component spinor
    wave-functions) together with its energy eigenvalue $E_{nj}$
    for hydrogenic atoms.
    \begin{equation} \label{eq:dirac-equation}
    \begin{array}{lcr}
        \left[
            e \Alpha \cdot \mb{p} + \beta mc^2 - \frac{Ze^2}{r}
        \right] \psi = E_{nj} \psi
    &
    \; ; \;
    &
    E_{nj} = \frac{mc^2}{
                \sqrt{
                    1 + \frac{(Z\alpha)^2}{n-j-\frac{1}{2} +
                    \sqrt{(j+\frac{1}{2})^2 - (Z\alpha)^2} }
                }
             }
    \end{array}
    \end{equation}
    Solutions to the Dirac equation for hydrogenic atoms are written in terms of
    four component spinors, separated in radial and angular components as
    defined in~\cite{Bethe-Salpeter}.
    There are two general spinor solutions $\psi_a$ corresponding to the case
    when $j=l+1/2$ and $\psi_b$ for the case when $j=l-1/2$.
    Note, also that the large and small components of the radial wave-functions are
    denoted by $g(r)$ and $h(r)$ instead of the more traditional $g(r)$ and $f(r)$,
    so as to avoid confusion with equation for the form factor which uses the symbol $f$.
    \begin{equation}
    \begin{array}{lr}
        \psi_a =
        \left(
            \begin{array}{c}
                g(r)    \sqrt{\frac{l+m+1/2}{2l+1}}     Y_{l,m-1/2}(\theta,\phi)    \\
                -g(r)   \sqrt{\frac{l-m+1/2}{2l+1}}     Y_{l,m+1/2}(\theta,\phi)    \\
                -ih(r)  \sqrt{\frac{l-m+3/2}{2l+3}}     Y_{l+1,m-1/2}(\theta,\phi)  \\
                -ih(r)  \sqrt{\frac{l+m+3/2}{2l+3}}     Y_{l+1,m+1/2}(\theta,\phi)
            \end{array}
        \right)
        &
        \psi_b =
        \left(
            \begin{array}{c}
                 g(r)   \sqrt{\frac{l-m+1/2}{2l+1}}     Y_{l,m-1/2}(\theta,\phi)    \\
                g(r)    \sqrt{\frac{l+m+1/2}{2l+1}}     Y_{l,m+1/2}(\theta,\phi)    \\
                -ih(r)  \sqrt{\frac{l+m-1/2}{2l-1}}     Y_{l-1,m-1/2}(\theta,\phi)  \\
                ih(r)   \sqrt{\frac{l-m-1/2}{2l-1}}     Y_{l-1,m+1/2}(\theta,\phi)
            \end{array}
        \right)
    \end{array}
    \end{equation}
    The radial components $g(r)$ and $f(r)$ of the spinors can be written in
    general in terms of the hypergeometric function $F(a,b,x)$.
    % g(r) radial component
    \begin{equation}
    \begin{split}
    g(r) = - \frac{\sqrt{\Gamma(2\gamma + n' + 1)}}{\Gamma(2\gamma+1)\sqrt{n'!}}
             \sqrt{\frac{1+\epsilon}{4N(N-x)}}
             \left( \frac{2Z}{Na_0} \right)^{3/2}
             e^{-Zr/a_0}
             \left( \frac{2Zr}{Na_0} \right)^{\gamma-1}
             \\
             \times
             \left[
                -n' F(-n'+1,2\gamma+1,\frac{2Zr}{Na_0})
                +
                (N-x) F(-n',2\gamma+1,\frac{2Zr}{Na_0})
             \right]
    \end{split}
    \end{equation}
    % h(r) radial component
    \begin{equation}
    \begin{split}
    h(r) = - \frac{\sqrt{\Gamma(2\gamma+n'+1)}}{\Gamma(2\gamma+1)\sqrt{n'!}}
             \sqrt{\frac{1-\epsilon}{4N(N-x)}}
             \left( \frac{2Z}{Na_0} \right)^{3/2}
             e^{-\frac{Zr}{Na_0}}
             \left( \frac{2Zr}{Na_0} \right)^{\gamma-1}
             \\
             \times
             \left[
                n' F(-n'+1,2\gamma+1,\frac{2Zr}{Na_0})
                + (N-x) F(-n',2\gamma+1,\frac{2Zr}{Na_0})
             \right]
    \end{split}
    \end{equation}
    Where we have $x = -(j+1/2)=-(l+1)$ if $j=l+1/2$, $x=j+1/2=+l$ if $j=l-1/2$,
    $\gamma = \pm\sqrt{x^2 - (Z\alpha)^2}$, $\epsilon = E/E_0$ (energy/rest mass
    energy), $n' = \alpha Z \epsilon/\sqrt{1 - \epsilon^2} - \gamma$,
    $N = \sqrt{n^2 - 2n'(k - \sqrt{k^2 - \alpha^2 Z^2})}$, $k = |x|$, and
    $m = \pm(l+1/2)$~\footnote{See Bethe and Salpeter~\cite{Bethe-Salpeter} for a
    detailed explanation of all these constants and definitions}.

    %========================================================================
    % GROUND STATE
    %========================================================================
    \subsection{The Ground State}
    The ground state (or $1S_{\frac{1}{2}}$) of the hydrogen atom corresponds to
    the quantum numbers $n=1$, $l=0$ and $j=\frac{1}{2}$. This corresponds to
    the $j = l+ \frac{1}{2}$ spinor.
    \begin{equation} \label{eq:dirac-ground}
	\ket{1S_{\frac{1}{2}}} = \ket{0} =
		\left(
			\begin{array}{c}
				A_{01}(\theta,\phi) \; g_0(r) \\
				A_{02}(\theta,\phi) \; g_0(r) \\
				A_{03}(\theta,\phi) \; h_0(r) \\
				A_{04}(\theta,\phi) \; h_0(r)
			\end{array}
		\right)
		=
		\left(
			\begin{array}{c}
				Y_{00} 	g_0(r)	\\
				0	 			\\
				-i \sqrt{\frac{1}{3}} Y_{10} h_0(r) \\
				-i \sqrt{\frac{2}{3}} Y_{11} h_0(r)
			\end{array}
		\right)
    \end{equation}
    %======================================================================
    \begin{equation} \label{eq:dirac-radial}
    \begin{array}{cc}
		g_0(r) = G_0 e^{-\frac{1}{2} \sigma_1 r} r^{\gamma_1 - 1} &
		h_0(r) = H_0 g_0(r)
    \\
    \\
	    H_0  =  - \sqrt{ \frac{1 - \epsilon_1}{1 + \epsilon_1} }	&
	    G_0  =  \left( \frac{2Z}{a_0} \right)^{3/2}
		  	   	\sqrt{\frac{1 + \epsilon_1}{2 \Gamma(2\gamma_1 + 1) }}
    \end{array}
    \end{equation}
    %======================================================================
    % FIRST EXCITED STATE
    %======================================================================
    \subsection{The First Excited State}
    \begin{equation}
	\ket{2S_{1/2}} = \ket{1} =
		\left(
			\begin{array}{c}
				A_{11}(\theta,\phi) g_1(r) \\
				A_{12}(\theta,\phi) g_1(r) \\
				A_{13}(\theta,\phi) h_1(r) \\
				A_{14}(\theta,\phi) h_1(r)
			\end{array}
		\right)
		=
		\left(
			\begin{array}{c}
				Y_{00} 	g_1(r)	\\
				0	 			\\
				-i \sqrt{\frac{1}{3}} Y_{10} h_1(r) \\
				-i \sqrt{\frac{2}{3}} Y_{11} h_1(r)
			\end{array}
		\right)
\end{equation}
\begin{equation}
\begin{array}{cc}
	g_1(r) = e^{-\frac{1}{2} \sigma_2 r} r^{\gamma_1}
	  		  \left( G'_{1}  \frac{1}{r} - G''_{1} \right)
    &
   	h_1(r) = H_1 \left( \frac{H'_1 - H''_1 r}{H'''_1 - H''''_1 r} \right) g_1(r)
\end{array}
\end{equation}

\begin{equation*}
\begin{array}{ccc}
	G_1 	 =  \left( \frac{2Z}{N_2 a_0} \right)^{3/2}
		  	  		\sqrt{\frac{2\gamma_1 + 1}{\Gamma(2\gamma_1 + 1)}}
		  	  		\sqrt{\frac{1 + \epsilon_2}{4N_2 (N_2 + 1)}}
    \; ; &
	G'_1 	 =  N_2 G_1 \sigma_2^{\gamma_1 - 1}
    \; ; &
	G''_1 	 =  \left( \frac{N_2 + 1}{2\gamma_1 + 1} \right) G_1 \sigma_2^{\gamma_1}
\end{array}
\end{equation*}
\begin{equation*}
\begin{split}
\begin{array}{ccc}
	H_1 	 =  -\sqrt{\frac{1 - \epsilon_2}{1 + \epsilon_2}}
    \; ; &
	H'_1 	 =  (2\gamma_1 + 1)(N_2 + 2)
    \; ; &
	H''_1 	 =  (N_2 + 1)\sigma_2
\end{array}
\\
\begin{array}{cc}
	H'''_1 	 =  (2\gamma_1 + 1)N_2
    \; ; &
	H''''_1  =  (N_2 + 1)\sigma_2
\end{array}
\end{split}
\end{equation*}

    	%=================================================================
		% The Second Excited State
		%=================================================================
    \subsection{The Second Excited State}
    \begin{equation}
	\ket{2P_{1/2}} = \ket{2} =
		\left(
			\begin{array}{c}
				A_{21}(\theta,\phi) g_2(r) \\
				A_{22}(\theta,\phi) g_2(r) \\
				A_{23}(\theta,\phi) h_2(r) \\
				A_{24}(\theta,\phi) h_2(r)
			\end{array}
		\right)
		=
		\left(
			\begin{array}{c}
				\sqrt{\frac{1}{3}} Y_{10} g_2(r) \\
			    \sqrt{\frac{2}{3}} Y_{11} g_2(r) \\
			    -i Y_{00} h_2(r) \\
				0
			\end{array}
		\right)
\end{equation}

\begin{equation}
\begin{array}{cc}
		g_2(r) = e^{-\frac{1}{2}\sigma_2 r} r^{\gamma_1}
				    \left(
						G'_2 \frac{1}{r} - G''_2
					\right)
    \; ; &
       	h_2(r) = H_2
			 \left(
			 	\frac{H'_2 - H''_2 r}{H'''_2 - H''''_2 r}
			 \right) g_2(r)
\end{array}
\end{equation}
\[
    \begin{array}{ccc}
	G_2 	 =  \left( \frac{2Z}{N_2 a_0} \right)^{3/2}
				  \sqrt{\frac{2\gamma_1 + 1}{\Gamma(2\gamma_1 + 1)}}
				  \sqrt{\frac{1+\epsilon_2}{4N_2 (N_2 - 1)}}
    \; ; &
	G'_2	 =  (N_2 - 2) \sigma_2^{\gamma_1 - 1} G_2
    \; ; &
	G''_2 	 =  \left( \frac{N_2 - 1}{2\gamma_1 + 1} \right) \sigma_2^{\gamma_1} G_2
    \end{array}
\]
\[
\begin{array}{cc}
	H_2		 =  -\sqrt{\frac{1-\epsilon_2}{1+\epsilon_2}}
    &
	H'_2	 =  (2\gamma_1 + 1)N_2
\end{array}
\]
\[
\begin{array}{ccc}
	H''_2 	 =  (N_2 - 1)\sigma_2
    &
	H'''_2 	 =  (2\gamma_1 + 1)(N_2 - 2)
    &
	H''''_2  =  (N_2 - 1)\sigma_2
\end{array}
\]

    	%=================================================================
		% The Third Excited State
		%=================================================================
    \subsection{The Third Excited State}
    \begin{equation}
	\ket{2P_{3/2}} = \ket{3} =
		\left(
			\begin{array}{c}
				A_{31}(\theta,\phi) g_3(r) \\
				A_{32}(\theta,\phi) g_3(r) \\
				A_{33}(\theta,\phi) h_3(r) \\
				A_{34}(\theta,\phi) h_3(r)
			\end{array}
		\right)
		=
		\left(
			\begin{array}{c}
				\sqrt{\frac{2}{3}} Y_{10} g_3(r) \\
			   -\sqrt{\frac{1}{3}} Y_{11} g_3(r) \\
			 -i \sqrt{\frac{2}{5}} Y_{20} h_3(r) \\
			 -i \sqrt{\frac{3}{5}} Y_{21} h_3(r)
			\end{array}
		\right)
\end{equation}
\begin{equation}
    \begin{array}{cc}
		g_3(r) = G_3 e^{-\frac{1}{2}\sigma_3 r}	r^{\gamma_2 - 1}
        \; ; &
        h_3(r) = H_3 g_3(r)
    \end{array}
\end{equation}
\[
\begin{array}{cc}
	G_3 =  	\left( \frac{Z}{a_0} \right)^{3/2}
			  \sqrt{ \frac{1 + \epsilon_3}{2\Gamma(2\gamma_2 + 1)} }
			  \sigma_3^{\gamma_2 - 1}
    \; ; &
	H_3  =   -\sqrt{ \frac{1 - \epsilon_3}{1 + \epsilon_3} }
\end{array}
\]

    \subsection{The Free Dirac Electron}
    The continuum state is described by a free Dirac electron state with energy $E$
    and momentum wave-vector $\mb{k'} = (k'_x,k'_y,k'_z)$.
    Such a state, can be represented by one of the two four-component spinors below.
    \begin{equation}
    \begin{array}{ccccc}
        \ket{\psi_c}_{\uparrow} =
        \left(
            \begin{array}{c}
                1                   \\
                0                   \\
                \xi k'_z            \\
                \xi (k'_x + ik'_y)
            \end{array}
        \right)
        & ; &
        \ket{\psi_c}_{\downarrow} =
        \left(
            \begin{array}{c}
                0                   \\
                1                   \\
                \xi(k'_x - ik'_y)   \\
                -\xi k'_z
            \end{array}
        \right)
        & ; &
        \xi = \frac{c\hbar}{E + E_0}
    \end{array}
    \end{equation}
    Where we have $E$ and $E_0$ as the electron's kinetic and rest mass energy
    respectively.
    The $\ket{\psi_c}_{\uparrow}$ represents the electron in the spin up state,
    whereas the $\ket{\psi_c}_{\downarrow}$ represents the electron in the spin
    down state.


\section{Task 3: Dense Matrix Multiplication}
The code for this assignment can be found in the \textit{src/Task3} folder
handed in with this report. All functions (where applicable) have been templated
so the datatype contianed in the matrices can be any class \texttt{T}.

The code ships with a make file that supports the \texttt{clean},
\texttt{compile} and \texttt{run} targets. The current setup of the file will
run both GPU kernels on an assymetric matrix and compare to the CPU runs.

\subsection{Task 3.a: Sequential CPU Code}
The code for this task is mainly found in the \textit{cpuFunc.cu.h} file, like
earlier it contains a number of convinience functions as well as the
multiplication function \texttt{flatMatrixMultiply}.

\subsection{Task 3.c: Naive GPU Code}
The code for this task is found in the \textit{gpuFunc.cu.h} file, it contains
the same convinience functions as earlier, but the kernel is now replaced with
\texttt{flatNaiveMutliplyKernel}, which is a naive matrix multiplication kernel.

\subsection{Task 3.d: Tiled-Memory GPU Code}
The code for this task is found in the \textit{gpuFunc.cu.h} file, the
shared-memory kernel is implemented in the function
\texttt{flatSharedMultiplyKernel}.

\subsection{Execution Time}

Table \ref{tab:task3time} shows the running times of the CPU code and the
Shared-Memory GPU kernel. Time time is done for 10 runs of each method and the
time represents the average time for a single run. The times only cover the time
spent in the calulation kernels, and does not cover the overhead for copying
data to device memory.

\begin{table}
    \begin{tabular}{|r|r|r|r|}
        \hline
        \textbf{Matrix Dimensions} & \textbf{CPU Time} & \textbf{Naive GPU Time} & \textbf{Tiled-Memory GPU Time}\\\hline
        $(2\times 4)\times(4\times 3)$ & $>0\mu s$ & $38\mu s$ & $22\mu s$ \\
        $(40\times 10)\times(10\times 8)$ & $33\mu s$ & $20\mu s$ & $17\mu s$ \\

        $10 \times 10$ & $10\mu s$   & $17\mu s$  & $16\mu s$ \\
        $20 \times 20$ & $86\mu s$   & $27\mu s$  & $16\mu s$ \\
        $30 \times 30$ & $274\mu s$  & $73\mu s$  & $18\mu s$ \\
        $40 \times 40$ & $637\mu s$  & $103\mu s$ & $20\mu s$ \\
        $50 \times 50$ & $1229\mu s$ & $124\mu s$ & $20\mu s$ \\
        $60 \times 60$ & $2109\mu s$ & $145\mu s$ & $21\mu s$ \\ \hline

    \end{tabular}
    \caption{The running times for the CPU and GPU code as the average over 10
    runs.}
    \label{tab:task3time}
\end{table}

Table \ref{tab:task3time} shows that the CPU based code starts out slower than
both the GPU kernels, it also shows that the Tiled-memory kernel have a lower
execution time than the naive kernel.


\section{P and NP}

%%%%%%%%%%
\begin{frame}{Computability theory first}
  \begin{theorem}{}
    Halting problem is undecidable.
  \end{theorem}

  \begin{proof}
    \fignocaption{width = 0.15\textwidth}{fig/turing.jpg}
  \end{proof}
\end{frame}
%%%%%%%%%%
\begin{frame}{Complexity theory to follow}
  \begin{columns}[t]
    \column{0.50\textwidth}
      Is a given Sodoku configuration solvable?

      \fignocaption{width = 0.40\textwidth}{fig/sudoku.png}
    \column{0.50\textwidth}
      Is $3 \times 3 \times 3$ Rubik's Cube solvable in 20 moves?

      \fignocaption{width = 0.45\textwidth}{fig/rubik.jpg}
  \end{columns}
\end{frame}
%%%%%%%%%%
\begin{frame}{Decision problems}
  \begin{definition}[Decision problems.]
    Decision problems are problems whose solution is ``Yes/No''.
  \end{definition}

  \begin{alertblock}{Remarks.}
    \begin{itemize}
      \item decision problem vs. optimization problem
      \item decision problem is ``hard'' $\Rightarrow$ its optimization problem is ``hard''
    \end{itemize}
  \end{alertblock}
\end{frame}
%%%%%%%%%%
\begin{frame}{Decision problems vs. optimization problem}
  \begin{exampleblock}{INDEPENDENT SET}
    \begin{block}{Optimization problem.}
      \begin{description}
	\item[Instance:] Undirected graph $G = (V, E)$.
	\item[Question:] Find the maximal independent set in $G$.
      \end{description}
    \end{block}

    \vspace{-0.30cm}
    \fignocaption{width = 0.20\textwidth}{fig/independent-set.png}
    \vspace{-0.50cm}

    \begin{block}{Decision problem.}
      \begin{description}
	\item[Instance:] Undirected graph $G = (V, E)$ and an integer $k$.
	\item[Question:] Does $G$ has an independent set of size (at least) $k$?
      \end{description}
    \end{block}
  \end{exampleblock}
\end{frame}
%%%%%%%%%%
\begin{frame}{The class P}
  \begin{definition}[The class P]
    P is the class of decision problems that are solvable in Polynomial time.
  \end{definition}

  \begin{exampleblock}{Examples for the class P}
    \begin{columns}[t]
      \column{0.30\textwidth}
	\begin{center}
	  Euler path.
	\end{center}
	\fignocaption{width = 0.75\textwidth}{fig/euler-bridge-graph.png}
      \column{0.30\textwidth}
	\begin{center}
	  Maze problem.
	\end{center}
	\fignocaption{width = 0.80\textwidth}{fig/maze.jpg}
      \column{0.30\textwidth}
	\begin{center}
	  Primality testing.
	\end{center}
	\fignocaption{width = 0.90\textwidth}{fig/primes.png}
    \end{columns}
  \end{exampleblock}
\end{frame}
%%%%%%%%%%
\begin{frame}{The class NP}
  \begin{definition}[The class NP]
    NP is the class of decision problems that are solvable in Polynomial time by \textcolor{blue}{Non-deterministic} algorithm.
    \[
      \text{NP} \neq \textrm{\textcolor{red}{N}on-\textcolor{red}{P}olynomial}
    \]
    \[
      \text{NP} \neq \textrm{\textcolor{red}{N}o \textcolor{red}{P}roblem}
    \]
  \end{definition}

  \pause
  \begin{definition}[Non-deterministic polynomial algorithm.]
    Given an instance $\mathcal{I}$ of a decision problem:
    \begin{description}
      \item[Guessing:] generate a certificate $c$ for $\mathcal{I}$
      \item[Verifying:] $V(\mathcal{I},c)$
    \end{description}

    \[
     O(\text{Guessing}) + O(\text{Verifying}) = O(n^{c})
    \]
  \end{definition}

\end{frame}
%%%%%%%%%%
\begin{frame}{Proof of being in NP}
  \begin{theorem}{}
    INDEPENDENT SET $\in$ NP.
  \end{theorem}

  \begin{proof}
    Given $G = (V,E)$ and $k$:
    \begin{description}
      \item[Guessing:] Nondeterministically select a subset $c$ of $k$ vertices of $G$.
      \item[Verifying:] Test whether $G$ contains no edges for all vertices pairs in $c$.
      \item[Output:] If the test passes, ouput ``yes''; otherwise, output ``no''.
    \end{description}
    The complexity is $O(n^{2})$.
  \end{proof}
\end{frame}
%%%%%%%%%%
\begin{frame}{The class NP}
  \begin{exampleblock}{Examples for the class NP}
    \begin{columns}[t]
      \column{0.30\textwidth}
	\begin{center}
	  Hamiltonian path.
	\end{center}
	\fignocaption{width = 0.75\textwidth}{fig/hamiltonian.png}
      \column{0.30\textwidth}
	\begin{center}
	  Clique problem.
	\end{center}
	\fignocaption{width = 0.80\textwidth}{fig/clique.jpg}
      \column{0.30\textwidth}
	\begin{center}
	  Knapsack problem.
	\end{center}
	\fignocaption{width = 0.70\textwidth}{fig/knapsack.png}
    \end{columns}
  \end{exampleblock}
\end{frame}
%%%%%%%%%%
\begin{frame}{P vs. NP}
  \begin{block}{P vs. NP}
    \[
      \text{P: polynomially solvable}
    \]

    \[
      \text{NP: polynomially verifiable}
    \]
  \end{block}

  \fignocaption{width = 0.50\textwidth}{fig/p-vs-np-dollars.jpg}
\end{frame}
%%%%%%%%%%
\begin{frame}{P vs. NP}
  \begin{theorem}{}
    \[
      \text{P} \subseteq \text{NP}.
    \]
  \end{theorem}

  \begin{proof}
    To design a non-deterministic polynomial algorithm given a deterministic polynomial algorithm (PA).
    \begin{description}
      \item[Guessing:] generate a certificate $c$ for instance $\mathcal{I}$.
      \item[Verifying:] ignore $c$; output $\text{PA}(\mathcal{I})$.
    \end{description}
  \end{proof}
\end{frame}
%%%%%%%%%%