[scikit-learn] Which sparse matrix should be use for fit?

Guillaume Lemaître g.lemaitre58 at gmail.com
Wed Jan 29 04:58:35 EST 2020


Looking at check_array in the SVR and SVC, we convert to CSR format if the
sparse matrices are not from this format:
https://github.com/scikit-learn/scikit-learn/blob/b194674c4/sklearn/svm/_base.py#L146

Basically, this is more efficient because we are going to make operation
which will get row.,

In scikit-learn most predictor expect CSR apart of tree-based where CSC
will be more efficient. CSC is also the format
which is better for the preprocessing estimator (in general). Be aware that
we are going to convert to the appropriate
format if required.

On Wed, 29 Jan 2020 at 02:54, Peng Yu <pengyu.ut at gmail.com> wrote:

> https://scikit-learn.org/stable/modules/svm.html
>
> Of the svm classes mentioned above, which sparse matrixes are
> appropriate to be used with them?
>
>
> https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.html#scipy.sparse.csr_matrix
>
> It is not very clear what matrix operations are used in fit(), so I
> can not tell what sparse matrixes should be used. Thanks.
>
> --
> Regards,
> Peng
> _______________________________________________
> scikit-learn mailing list
> scikit-learn at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn
>


-- 
Guillaume Lemaitre
Scikit-learn @ Inria Foundation
https://glemaitre.github.io/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20200129/24159a5b/attachment.html>


More information about the scikit-learn mailing list