How to select optimal number of K in KNN technique?

machine_learning

#1

tune length in caret


#2

Can anyone explain repeats ans tuneLength parameter mention below?

control <- trainControl(method=“repeatedcv”, number=10, repeats=5)
model <- train(Species~., data=iris, method=“lvq”, trControl=control, tuneLength=5)