Added brian.md to 04-ML_KNN

In a word: no. No it was not the intent.


On Monday, August 4, 2014 4:31 PM, Aaron Schumacher <notifications@github.com> wrote:
 


In 04-ML_KNN/brian.R:
> +
> +iris.nn <- function(training_data, labels, test_data, K = 1) {
> +  test_data[labels] <- NA
> +  predicto <- apply(test_data, 1, function(x){ assign.score(x, labels, training_data) })
> +  test_data[labels] <- predicto
> +  return(test_data)
> +}
> +
> +outcome = "Species"
> +scramble <- iris[sample(nrow(iris)),]
> +train <- scramble[1:120,1:5]
> +test <- scramble[121:150,1:5]
> +
> +z <- iris.nn(train, outcome, test, 3)
> +
> +mean(rep(z$Species == scramble[121:150,]$Species, 4000)) 
There's nothing stochastic here; every rep is exactly the same - is that the intent?
—
Reply to this email directly or view it on GitHub.