Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What does kmax and ks in train.kknn refer to?

Can someone explain to me how train.kknn works? In particular, I am wondering what kmax and ks are? Are they referring to the k of the nearest neighbor model? Or are they referring to the k of k-folds?

I looked up the documentation but did not find anything more specific (https://cran.r-project.org/web/packages/kknn/kknn.pdf).

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

what kmax and ks are?

kmax is the maximum number of k that you want to test. For example, if you set kmax = 11, train.kknn will try all values of k from 1 to 11 and choose the one that gives the best performance.

ks is a vector that specifies the exact values of k that you want to test. For example, if you set ks = c(3, 5, 7), train.kknn will only try these three values of k and choose the best one.

Are they referring to the k of the nearest neighbor model? Or are they referring to the k of k-folds?

You can specify some parameters when you use train.kknn, such as kmax and ks. They both refer to the k of the nearest neighbor model, not the k of k-folds.

You can examine the examples in the link below;

Train.kkn RDRR

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading