In RapidMiner I want to create a k-NN model in order to create a classifier. To generate the test sets and the training sets I use the the cross-validation.

If I choose 10 as the number of folds, the cross-validation algorithm will do 10 iterations with different test sets and training sets.

At the end, what training set will be used to create my k-NN model ?

  • $\begingroup$ The classifier is trained with the whole dataset. The cross-validation folding is done in order to have a statistical measure of the "quality" of the model, For instance, you set K=3 and some certain distance, then, with the 10-fold-CV you have an average accuracy of the model given these parameters, and the final classifier should be one which has been trained with the whole training set. $\endgroup$ – ignatius May 16 '18 at 8:51

Apart from having an average accuracy of the trained model, also you can use cross-validation to approximate the optimal value for the k parameter and the optimal metric.

  • $\begingroup$ This generalises to the more common use of cross-validation to tune algorithm hyperparameters. $\endgroup$ – bradS May 16 '18 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.