K-Nearest Neighbors (KNN) Classification
classification.knn.Rd
This function applies KNN classification to the harmonized data in the input precision object containing. It supports two thresholding methods: cross-validation to optimize the number of neighbors (k) or a fixed k value of 1.
Arguments
- object
A precision object containing harmonized data. Must contain the slots
harmon.train.data
with harmonized training data andharmon.test1.data
andharmon.test2.data
with harmonized test data.- threshold_method
A character string specifying the thresholding method. Use
"cv"
for cross-validation to determine the optimal k, or"none"
to use a fixed k = 1.- kfold
An integer specifying the number of folds for cross-validation. This parameter is only used if
threshold_method
is set to"cv"
.- folds
An optional list of pre-specified folds for cross-validation. If provided, these folds will be used instead of generating new ones.