0
$\begingroup$

I have a dataset and I divided it into test data and train data. Can anyone suggest how to perform LOOCV for KNN regression? Is there any library?

val(train.data,train.label,K,numfold)

Thanks in advance

$\endgroup$
2
1
$\begingroup$

To learn how its done, simplest way is to give a try on sklearn and then try to implement the same by yourself-

https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.LeaveOneOut.html

and a very basic level explanation here- https://medium.com/@svanillasun/how-to-deal-with-cross-validation-based-on-knn-algorithm-compute-auc-based-on-naive-bayes-ff4b8284cff4

$\endgroup$
1
$\begingroup$

caret can use LOOCV as its trainControl method:
https://topepo.github.io/caret/model-training-and-tuning.html#the-traincontrol-function

$\endgroup$

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.