Hi all!

I am playing around with the KNeighboursClassifier class and have a
question/concern:

When I use the default parameters the code runs smoothly in 709 ms:
%%timeit
model = KNeighborsClassifier()
model.fit(X_train, y_train)
print(model.score(X_valid, y_valid))

Now I don't change anything, except, e.g., the distance class used:
%%timeit
model = KNeighborsClassifier()
model.metrics = 'manhattan'
model.fit(X_train, y_train)
print(model.score(X_valid, y_valid))

In my understanding the Manhattan distance shouldn't be more expensive than
the euclidean distance, but the code above runs at least a few minutes
until I decide to interrupt it. (It shouldn't even take 3 or 4 times as
long, right?)

That also happens, when I just change the p value to 1.

Is there something I miss?
------------------------------------------------------------------------------
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to