\documentclass{article}
\usepackage{url,amsfonts,amsthm,multicol,amsmath,multicol}
\usepackage{graphicx,enumerate,amsfonts,makeidx,fullpage}
% The following two lines are for color boxed text (which I may not use; see bestbasis.tex (section Summary))
\usepackage{xcolor}
\usepackage[framemethod=tikz]{mdframed}


\usepackage{hyperref}
\hypersetup{
  colorlinks   = true,    % Colours links instead of ugly boxes
  urlcolor     = blue,    % Colour for external hyperlinks
  linkcolor    = blue,    % Colour of internal links
  citecolor    = red      % Colour of citations
}

\setcounter{tocdepth}{1}

\def\mcal{\cal}
\newcommand{\bb}[1]{\mbox{\boldmath $ {#1} $} }
\newcommand{\mbf}[1]{\mbox{\boldmath ${#1} $} }  %For vectors
\newcommand{\mbs}[1]{\mbox{\boldmath ${#1} $} }  %For \boldsymbol{ greek }
\def\R{{\mathchoice{\rm I\hskip-.2em R}{\rm I\hskip-.2em R}
    {\rm I\hskip-.15em R}{\rm I\hskip-.1em R}}}
\def\Re{{\mathchoice{\rm I\hskip-.2em R}{\rm I\hskip-.2em R}
    {\rm I\hskip-.15em R}{\rm I\hskip-.1em R}}}
\def\Ce{\mathbb{C}}
\newcommand{\abs}[1]{\left|#1\right|}

\title{Pima Diabetes Study - Sample Write Up}
\author{Your Name(s) Here}
\date{\today}


\begin{document}

\maketitle

\abstract{
We analyzed the Pima Diabetes data using a k-nearest neighbor
classifier.  We scaled the data, visualized it using Principal
Components Analysis, and then determined an optimal value
for the number of nearest neighbors using a 5-fold cross validation
study.  Finally, we built our classifier and reported the results.
We used 23 nearest neighbors, and found an accuracy of 73\% using
our technique.
}

\section{Problem Discussion}

In the problem discussion, give any background that might be relevant (if you're given any, of course).
Give the reader an idea of what the problem is that you're trying to solve.  Here's an example (from Kaggle).

This dataset is originally from a study done in 1988 \cite{dataref}. The objective of the dataset is to diagnostically predict whether or not a patient has diabetes, based on certain diagnostic measurements included in the dataset. Several constraints were placed on the selection of these instances from a larger database. In particular, all patients here are females at least 21 years old of Pima Indian heritage.

In the next section, we'll give an overview of the data, and look at any scaling protocols
that may be necessary.  In the section after that, we'll build an appropriate nearest neighbor
classifier, then finally we'll take a look at the results.


\section{The Data}

The data consists of 8 possible variables and one outcome value for a total of 9 columns.
There are 768 total records, so the original data matrix is $8\times 768$.
Before we visualize the data, the 8 variables are:
\begin{multicols}{2}
\begin{enumerate}
\item Number of pregnancies.
\item Plasma glucose concentration
\item Diastolic blood pressure
\item Triceps skin fold thickness
\item Two hour serum insulin
\item BMI
\item Diabetes Pedigree Function
\item Age 
\end{enumerate}
\end{multicols}
The mean and standard deviation of the 8 variables are given in the table below.

\bigskip

\begin{center}
\begin{tabular}{l|cccccccc}
     & Preg  & Gluc   & BP     & Skin  & Insulin & BMI & Ped & Age\\
\hline
mean & 3.85  & 120.89 &  69.11 & 20.54 & 79.80  & 31.99 & 0.47 & 33.24\\
std  & 3.37  &  31.97 &  19.36 & 15.95 & 115.24 & 7.88  & 0.33 & 11.76
\end{tabular}
\end{center}

\bigskip

There was enough differences in the scales that we decided to perform
a standard scaling across all variables to make each have zero mean and
unit standard deviation.

To visualize the two classes, we performed a Principal Components Analysis
on the data, with the results shown graphically.  The blue asterisks are
class 1, and the black circles are class 2.  Also, the first six singular 
values were somewhat close, from 0.11 to 0.19, with the next lowest at $0.08$,
suggesting that perhaps the rank is close to 6.

Before going into the classification stage, we reserved 30\% of the data (233 points)
chosen randomly, for the test set, and that left us with 535 points for training. 

\begin{center}
\includegraphics[width=4.0in]{reportPCA}
\end{center}

\section{Construction of the Classifier}

We performed a 5-fold cross validation study to determine the best number
of neighbors.  Repeating the process several times led us to determine an
approximate number of neighbors, 23.  The graph below shows the error rate
for each choice of neighbors, from 3 to 35.

\begin{center}
\includegraphics[width=4.0in]{BestK}
\end{center}

Finally, we used the full training set to classify the test set that
was reserved initially.

\section{Results}

The results of the classification are summarized below in the confusion matrix.
The predicted classes are shown in rows, the actual classes in the columns.

\bigskip

\noindent
\begin{minipage}{0.6\textwidth}
We did not have an equal class representation, as we
see that 66\% (152/230) of our sample population was in class 1.
Of the actual class 1 samples, we were able to predict
that 87.5\% accuracy, and in class 2, 45\% (78/230).  We can
see that predicting class 1 was better than class 2,
perhaps because class 1 had more separation.

The overall accuracy was 73\%.

\end{minipage}
\begin{minipage}{0.35\textwidth}
$$
\begin{array}{c|cc|c}
  & 1 & 2 & \\
\hline  
1 & 133& 43 & 176\\
2 & 19 & 35 & 54\\
\hline
  & 152 & 78 & 230
\end{array}
$$
\end{minipage}


%
  I'm including several references not cited just so you can see some options.
 The only references that should be included below are ones that are cited in the text.





%\singlespacing
\begin{thebibliography}{99}
\addcontentsline{toc}{section}{References}

\bibitem{dataref} Smith, J.W., Everhart, J.E., Dickson, W.C., Knowler, W.C., \& Johannes, R.S. (1988). Using the ADAP learning algorithm to forecast the onset of diabetes mellitus. {\it In Proceedings of the Symposium on Computer Applications and Medical Care} (pp. 261--265). IEEE Computer Society Press.

\bibitem{matlab} The Mathworks Inc. (n.d.). Image types in the
toolbox. In Image processing toolbox. Retrieved at
\url{http://www.mathworks.com/access/helpdesk/help/toolbox/images/f14-13543.html}.

\bibitem{lay} D. C. Lay, \textit{Linear algebra and its
applications}. Addison Wesley, New York, NY 2003.
\end{thebibliography}


\section{Appendix: Code}

\begin{verbatim}

Put the main part of your code here.

In Matlab, you don't need to include the 6 files that 
I provided in the zip folder, but do provide your "driver"
or script file.

\end{verbatim}

\end{document}