Hi,

Can you please let me know what is the distance measure used in KNN algorithm? How to specify the distance measure to be used in the knn in R? Is it possible to use cosine value in KNN?

Thanks !!

Varnikaa

Hi,

Can you please let me know what is the distance measure used in KNN algorithm? How to specify the distance measure to be used in the knn in R? Is it possible to use cosine value in KNN?

Thanks !!

Varnikaa

The distance metric used in ‘knn’ from ‘class’ library is Euclidean distance. I think we can’t change the distance metric in this function.

However in ‘kknn’ we can specify the parameter for minowski distance (minowski=2 is euclidean distance). I am not sure whether cosine distance can be specified here.