Quantcast
Channel: improve linear search for KNN efficiency w/ NumPY - Stack Overflow
Browsing index pages (2 articles)
↧

improve linear search for KNN efficiency w/ NumPY

I am trying to calculate the distance of each point in the testing set from each point in the training set:This is what my loop looks like right now: for x in testingSet for y in trainingSet print...

View Article


Answer by lejlot for improve linear search for KNN efficiency w/ NumPY

This is because you naively iterate over your data, and loops are slow in python. Instead, use sklearn pairwise distance functions, or even better - use sklearn efficient nearest neighbour search (like...

View Article

Browsing index pages (2 articles)


Latest Images