Tommy,

If I understand you correctly, you are saying that after the data was
randomized and tmp.df was created I could have just referenced the rows in
the tmp.df dataframe and not created the other two dataframes...

I'll go along with that.

Will you be in early today, I'd like to sneak in a few questions before
class.

Garon


On Fri, Mar 21, 2014 at 8:06 PM, Tommy Shen <notifications@github.com>wrote:

> In 04-ML_KNN/garon-knn.rmd:
>
> > @@ -0,0 +1,32 @@
> > +Homemade K Nearest Neighbor Program
> > +========================================================
> > +
> > +This is an attempt to create a program to determine the K Nearest Neighbor for a set of test data.  It uses the time-worn Iris dataset to prove the concept.
> > +For me, learning R is a struggle to understand, visualize, and internalize the concepts of vectors, arrays, and dataframes.  I can see how powerful they are, but as I struggle with syntax and concepts of the new language, I am just not truly grasping them yet.  This code then, is more old, procedural language than the shiny new dataframe style of programming.
> > +
> > +On the plus side, the KNN is effective in predicting the label based on the features (see, did learn some new lingo).
> > +
> > +After I turn this in I will look at other solutions and talk to people who are brighter than I so I can use the apply statement and vectorize this code a little more.  Perhaps I will also make the output and the markdown document prettier.
> > +
> > +```{r}
> > +tmp.df <- iris[sample(1:150,150),]
> > +tng.df <- tmp.df[1:120,]
> > +tst.df <- tmp.df[121:150,]
> > +for ( j in 1:nrow(tst.df)) {
>
> You had an interesting way of randomizing the row order. Why not just
> initialize your for loops like this: for(j in 121:150) and for(i in 1:120)?
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/ajschumacher/gadsdc1/pull/60/files#r10858978>
> .
>