If I have to use scikit-learn (sklearn) library for classification and the feature matrix is a sparse matrix, then which of the classification algorithms of this library can be used by me?


2 Answers 2


From this kaggle discussion, the classification algorithms from scikit-learn that support sparse matrices are at least:

  • linear_model.LogisticRegression()
  • svm.SVR()
  • svm.NuSVR()
  • naive_bayes.MultinomialNB()
  • naive_bayes.BernoulliNB()
  • linear_model.PassiveAggressiveClassifier()
  • linear_model.Perceptron()
  • linear_model.Ridge()
  • linear_model.Lasso()
  • linear_model.ElasticNet()
  • linear_model.SGDClassifier()

Also, from this quora question, you can check in the implementation of the algorithm if they import scipy.sparse.csr_matrix .


In addition to @ncasas 's links, Here is the full list of classification/regression/feature selection and few more by David Ziganto's blog. Which I referred last week-


Also, from sk-learn documentation, they have example code for text classification which is using few of models.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.