0

Since I'm new to machine learning and I'm trying to build the model using caret package available in R.

I have a small confusion when using repeated cv method. Resampling output shows desired parameters which has highest accuracy. I did not clearly understand this part.

Below is my result when building Knn model for iris data set.

k-Nearest Neighbors 

105 samples


4 predictor

3 classes: 'setosa', 'versicolor', 'virginica' 

Pre-processing: centered (4), scaled (4) 

Resampling: Cross-Validated (10 fold, repeated 3 times) 

Summary of sample sizes: 95, 95, 94, 93, 94, 93, ...

Resampling results across tuning parameters:

  k        Accuracy        Kappa   

  5    0.9476263      0.9211025

  7  0.9379293  0.9066532

  9  0.9278620  0.8914058

Accuracy was used to select the optimal model using  the largest value.
The final value used for the model was k = 5

question: How are the different k values are selected?

David Heckmann
  • 2,899
  • 2
  • 20
  • 29

0 Answers0