-
Notifications
You must be signed in to change notification settings - Fork 223
WIP Python performance #162
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
Conversation
|
Thanks. We'll run some tests, and merge the PR. Our team is currently working on paper deadlines, so it may take some time. |
QinbinLi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! First, there is an error in your updates. In line 98, you should remove "self.". Second, I'm not very familiar with python memory management. If you use "frombuffer", is it possible that the original memory (e.g., csr_row) has been released and then the class member (e.g., self.row) becomes invalid although the class is still being used? If this case cannot happen, I can merge your pull request. Thanks.
|
I'm not very familiar with C/C++ memory management, so let's discuss this. My current understanding is this: After fitting, the support vectors live somewhere in memory not handled by Python initially. In Python, first If there is no copy made in |
|
Hi, @VarIr You are right. There is copy inside |
EDIT: Please see issue #172I am having a similar issue. I am using the latest master branch of thundersvm. Here is my test code if you would like to try replicate this (dataset is BNG_COMET: https://www.openml.org/d/5648): ThunderSVM test: Sklearn test: |
|
Is the problem still there? If so, please open a new issue, such that we can find a time to fix it. |
|
@zeyiwen thanks for your help. I will open a new one now. |
Under certain circumstances ThunderSVM is surprisingly slow when invoked via the Python bindings. In my current use case, I have replicated nested cross-validation procedures with relatively small data sets (that is, many calls to
fitandpredict). There, currently significant time seems to be spent in list comprehensions that create numpy arrays from ctypes.A quick-fix seemed to be exchanging the list comprehensions with calls to
np.frombuffer, which improved speed quite a bit.I created this PR in case you're interested to include these changes into upstream.