Added HW4 Code

Turning in 1NN code for HW4.  Sorry for the delay - thanks!
Sinan, thanks - looking at my code I just miswrote the comment. I'd kept
all of the columns in the training data.  Thanks again for the help and
review!

Best,
Andy


On Thu, Aug 7, 2014 at 7:00 PM, Sinan Ozdemir <notifications@github.com>
wrote:

> In 04-ML_KNN/1NN.AJV.R:
>
> > +  for (j in 1:length(test.data[,1])) {
> > +
> > +    ##Step through the test data
> > +    for (i in 1:length(training.data[,1])) {
> > +      ##Calculate distance from all test rows against given training data row
> > +      distance[j,i] <- sqrt(rowSums((test.data[j,1:4]-training.data[i,1:4])^2))
> > +
> > +      }
> > +
> > +    ##calculate the closest training row to the test row.
> > +    nearest.row <- which.min(distance[j,])
> > +
> > +    ##print(training.data[nearest.row,5])
> > +
> > +    ##map the result into results dataframe
> > +    result1[j,6] <- training.data[nearest.row,5]
>
> if training.data is only the first four columns of iris (the numeric
> values), I believe this line should read:
> result1[j,6] <- labels[nearest.row]
>
> --
> Reply to this email directly or view it on GitHub
> <https://github.com/ajschumacher/gadsdc2/pull/80/files#r15969892>.
>