# Which of the scikit learn classification algorithms accept Sparse matrices?

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?

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-

https://dziganto.github.io/Sparse-Matrices-For-Efficient-Machine-Learning/

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

https://scikit-learn.org/0.15/auto_examples/document_classification_20newsgroups.html