Quantcast
Channel: Is there a way to make this Python kNN function more efficient? - Stack Overflow
Browsing latest articles
Browse All 3 View Live

Answer by user2379410 for Is there a way to make this Python kNN function...

You're just running into the slowness of Python (or rather the CPython interpreter I should say I guess). From wikipedia:NumPy targets the CPython reference implementation of Python, which is a...

View Article


Answer by Ara for Is there a way to make this Python kNN function more...

Here are the points I can think of:you are computing the distance between one sample and every other every time you call closestK so you compute the distance between every sample twice (once...

View Article

Is there a way to make this Python kNN function more efficient?

After having troubles with MATLAB I decided to try Python:I wrote a function that calculates kNN when the samples are of my own class using my own distance function:def closestK(sample, otherSamples,...

View Article
Browsing latest articles
Browse All 3 View Live