Why sklearn uses as default metric the minkowsky distance for the knn model among the the other available metrics ?
Let’s have a look at the other default parameters of this estimator:
In [1]: from sklearn.neighbors import KNeighborsClassifier
In [2]: KNeighborsClassifier().get_params()
Out[2]:
{'algorithm': 'auto',
'leaf_size': 30,
'metric': 'minkowski',
'metric_params': None,
'n_jobs': None,
'n_neighbors': 5,
'p': 2,
'weights': 'uniform'}
So the default value for the parameter p
is 2 and Minkowsky with p=2 is the same as the Euclidean distance. So effectively the default metric of scikit-learn’s KNN is the usual Euclidean distance.