What is the best way to handle sparse data on scikit-learn?
-
I am writting an instance reduction module on scikit-learn. It is working, but when compiling/testing it gives following error: =================================================ERROR: sklearn.tests.test_common.test_estimators_sparse_data ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/nose/http://case.py", line 197, in runTest self.test(*self.arg) File "/home/dayvid/workspace/scikit-learn/sklearn/tests/http://test_common.py", line 145, in test_estimators_sparse_data raise exc ValueError: data type not understood Here is one of the class signatures: class CondensedNearestNeighbors(BaseEstimator, ClassifierMixin, InstanceReductionMixin) If I use scipy.sparse.issparse(X), it says that it doesn't fail gracefully. Please, help, I have over 14 algorithms (some of them algorithms of this year) and I'm really excited about contributing to sklearn. Thanks
-
Answer:
Upgrade to 0.14 and use k-means!(for speed) PS: It helps more if you pick the domain of your problem and pick the tools for that domain e.g. or-tools for OR problems, cvxopt if you want to do convex optimisation ....rather than diving in to split wide open esp as a beginner. sklearn random forests,for instance, do not work on sparse inputs . It d slap you with "ValueError: array is too big." if you do that and so will Gmm, [1]Been there , did the latter and hated the burden.
Sameer Gupta at Quora Visit the source
Related Q & A:
- What is the best way to learn English?Best solution by Yahoo! Answers
- What is the best way to learn how to build websites and web applications with Python?Best solution by Quora
- What is the best way to learn jazz piano?Best solution by Yahoo! Answers
- What is the best way to learn French?Best solution by Yahoo! Answers
- What is the best way to learn drawing anime?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.