CVerrorknn: k-Fold Cross Validation Error Rate for KNN
Description
Given a dataset with predictors and a vector with responses, a number of
neighbors K, and a number of folds k, the k-fold CV error rate for KNN is
calculated.
Usage
CVerrorknn(pred, resp, K = 1, k = nrow(pred))
Value
The k-fold CV error rate if k is entered, otherwise the LOOCV error rate.
Arguments
pred
A dataset with predictors
resp
A vector with responses
K
The number of neighborhoods to consider when performing KNN