How does Scikit learn KNN handle categorical input variables?

In some articles, it's said knn uses hamming distance for one-hot encoded categorical variables. Does the scikit learn implementation of knn follow the same way.

Also are there any other ways to handle categorical input variables when using knn.

Topic k-nn one-hot-encoding regression scikit-learn classification

Category Data Science


As stated in the docs, the KNeighborsClassifier from scikit-learn uses minkowski distance by default.
Other metrics can be used, and you can probably get a decent idea by looking at the docs for scikit-learn's DistanceMetric class

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.