由于我是机器学习的新手,我正在尝试使用R中提供的插入包来构建模型。
使用重复的cv方法时我有一点混乱。重采样输出显示具有最高精度的所需参数。我没有清楚地理解这一部分。
以下是为虹膜数据集构建Knn模型时的结果。
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
问题:如何选择不同的k值?