data(iris)
model <- gknn(Species ~ ., data = iris)
predict(model, iris[c(1, 51, 101),])
test = c(45:50, 95:100, 145:150)
model <- gknn(Species ~ ., data = iris[-test,], k = 3, method = "Manhattan")
predict(model, iris[test,], type = "votes")
model <- gknn(Species ~ ., data = iris[-test], k = 3, method = "Manhattan")
predict(model, iris[test,], type = "prob")
Run the code above in your browser using DataLab