-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClassifierEvaluator is slow #1
Comments
It takes me like 45 seconds to do a KNN Regression over 20,000 rows.. but Ruby is single threaded right? Using a Postgresql DB.. |
Yeah...I've been meaning to get to this but haven't got around to it. Yes, useful multi-threading is not available in Ruby but I don't think that's the biggest bottle-neck here. The method just isn't written in an efficient way. I can spend some time speeding this up this week unless you'd like to try. For benchmarking, are you able to share the specific data and code you're using? |
I'll take a crack at it.. no promises! |
Awesome! Let me know if I can support in any way. Can you clarify, is the 45 seconds how long it takes to make predictions with your KNN model or to run the |
It takes around 45 seconds to make a prediction on 20,000 rows with 5 attributes. |
Ok. I see, so this is for the KNN Classifier, not for the The nearest neighbor search is not very efficient now. It's does a full scan of all data points and computes the distance from your new observation for each. It's possible to only compute the distance metric for a subset of the training data. KDTrees is one solution. Here is an introduction to KDTrees and how they can be used for speeding up nearest neighbor searches. I know sklearn uses ball trees as another option for nearest neighbor search but if I'm honest I know less about this algorithm. I found this post which explains a bit about KD trees and ball trees. |
Even for a fairly small data set,
Lurn::Evaluation::ClassifierEvaluator
can take 10+ seconds to calculate precision and recall. This isn't very complicated math and should be a lot faster.The text was updated successfully, but these errors were encountered: