[scikit-learn] Using fit_intercept with sparse matrices

Jaidev Deshpande deshpande.jaidev at gmail.com
Sat Jul 2 09:40:47 EDT 2016


I usually encounter many cases when I've forgotten that my input to the
`AnyEstimator.fit` method is a sparse matrix, and I've set

To avoid this, I could of course make a habit of not tampering with the
default `fit_intercept=True`, but I think it would be better and more
idiot-proof if the method raises a warning saying something like,

"fit_intercept=False works best when the data is centered, and sparse
matrices can't be centered. Please set fit_intercept=True for better

What do you think? If doing this is worthwhile, I'll send a PR.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20160702/27a43173/attachment.html>

More information about the scikit-learn mailing list