How do I use knn model for new data in R?
问题 I've just written a knn model in R. However, I don't know how to use the output to predict new data. # split into train (treino) and test (teste) treino_index <- sample(seq_len(nrow(iris)), size = round(0.75*nrow(iris))) treino <- iris[treino_index, ] teste <- iris[-treino_index, ] # take a look at the sample head(treino) head(teste) # save specie from later treino_especie = treino$Species teste_especie = teste$Species # exclude species from train and test dataset treino = treino[-5] teste =