Quantcast
Channel: improve linear search for KNN efficiency w/ NumPY - Stack Overflow
Viewing all articles
Browse latest Browse all 2

improve linear search for KNN efficiency w/ NumPY

$
0
0

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 numpy.linalg.norm(x-y)

Where testingSet and trainingSet are numpy arrays where each row of the two sets hold the feature data for one example.

However, it's running extremely slowly, taking more than 10 minutes since my data set is bigger (testing set of 3000, training set of ~10,000). Does this have to do with my method or am I utilizing numPY incorrectly?


Viewing all articles
Browse latest Browse all 2

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>