Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which estimators in scikit-learn don't support sparse matrices?

Tags:

scikit-learn

I want to train a dataset that has a lot of nominal attributes. I noticed from some posts that to convert nominal attributes on has to transform them into repetitive binary features. Also as I understood that doing so will conceptually make the dataset sparse. Also I know that scikit-learn uses sparse matrices with some estimators because it's faster or so. But also I found that some estimators don't accept sparse matrices, still. My question is: which ones don't accept sparse matrices until now?

like image 878
Jack Twain Avatar asked Apr 26 '26 01:04

Jack Twain


1 Answers

You can check whether a method in scikit-learn supports sparse matrices by checking the docstring. If it says

X : {array-like, sparse matrix}

then sparse matrix inputs are supported. When it says just "array-like", they're not supported.

like image 118
Fred Foo Avatar answered Apr 30 '26 09:04

Fred Foo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!