Repository navigation
MRG: merge sparse and dense SVMs - #576
Conversation
|
Thanks heaps \o/. +1 for the new convention too |
|
One thing I don't like in the current sparse.SVC implementation is that the dual coefficients are stored in a a sparse matrix. Not only this introduces an API difference between the dense and sparse implementations, there is also no reason to do that: the sparsity of the coefficients has nothing to do with the sparsity of X. I would much prefer if we used the same attributes as for the current dense implementation. This should also make the new merged class smaller and easier to understand. |
|
I was wondering why that was done. If you say sparse coefficients doesn't speed things up (I remember, I believe, @pprett's timings of sparse coefficients in SGD) then I'll be happy to remove them. |
|
I believe a vector of size |
|
I'll look into this over the weekend. Good opportunity to brush up on my knowledge of SVMs :) |
|
Thanks a lot for doing this :) Could we maybe merge my svm fix before that? I faced the sparsity issue there, too, and decided to make coef_ sparse for consistency even though that makes little sense. |
|
Is that #546? I'd prefer not to have a sparse datastructure anywhere just for consistency; they should only be used when necessary for memory use and/or speed. Won't your patch slow SVMs' |
|
Yes, it is #546. |
|
Okay, got the tests. Dense coefficients will take more time, though. |
|
@larsmans : Do you think it should be addressed in this PR or in another one? |
|
Let's do it in a separate PR. This one's up for review and merge. |
|
The TODO list in the PR summary tells that the tests and documentation need to be updated. Is it still the case? I think the tests are ok but not sure about the doc. |
|
Updated the docs! |
|
What's the state of this PR? I may have to touch the bindings at some point... |
|
I believe it's finished, it just needs to merge with master once more. You can merge it manually if you want, I'm a bit busy. |
* enable sparse matrix support in formerly dense versions * remove DenseBaseLibSVM * move sparse.libsvm to libsvm_sparse
* keep sparse.* behavior: will transform dense data into sparse data when fitting (we might want to deprecate this along with the classes) * document sparsity support in classes.py
|
Apparently, I screwed up when pushing the doc updates. I redid them, rebased on current |
|
If the full test suite (including doctests) pass on your box, +1 for merging. |
|
+0 for merging, have no time for a review at the moment, methinks. |
|
Yep, all 50 tests + all 9 doctests succeed. |
|
+1 for merge! Thanks again @larsmans! |
merge sparse and dense SVM classes
|
Thanks for this "tour de force" indeed. BTW: on my bot I have for the full suite (code and doc tests): |
This branch merges support for sparse matrices into the vanilla SVM classes.
I propose a new convention for the SVMs: they support sparse data in predict iff they have been fit on sparse data. This is different from the current behavior of
svm.sparse.*, which is to convert dense sample arrays to CSR matrices.