8000 TST Extend tests for `scipy.sparse.*array` in `sklearn/svm/tests/test_sparse` by Charlie-XIAO · Pull Request #27723 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

TST Extend tests for scipy.sparse.*array in sklearn/svm/tests/test_sparse #27723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Nov 18, 2023

Conversation

Charlie-XIAO
Copy link
Contributor

Towards #27090, continuation of #27511.

Copy link
github-actions bot commented Nov 4, 2023

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: c481b3d. Link to the linter CI: here

@Charlie-XIAO
Copy link
Contributor Author

@jjerphan I have fixed the bug met by @work-mohit, would you like to take a look?

Copy link
Member
@jjerphan jjerphan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo a few changes and a changelog entry.

@jjerphan
Copy link
Member

One last thing: could you add an entry in this section for 1.4's changelog? :)

Support for SciPy sparse arrays
-------------------------------
Several estimators are now supporting SciPy sparse arrays. The following functions
and classes are impacted:
**Functions:**
- :func:`cluster.compute_optics_graph` in :pr:`27104` by
:user:`Maren Westermann <marenwestermann>` and in :pr:`27250` by :user:`Yao Xiao <Charlie-XIAO>`;
- :func:`cluster.kmeans_plusplus` in :pr:`27179` by :user:`Nurseit Kamchyev <Bncer>`;
- :func:`decomposition.non_negative_factorization` in :pr:`27100` by
:user:`Isaac Virshup <ivirshup>`;
- :func:`feature_selection.f_regression` in :pr:`27239` by
:user:`Yaroslav Korobko <Tialo>`;
- :func:`feature_selection.r_regression` in :pr:`27239` by
:user:`Yaroslav Korobko <Tialo>`;
- :func:`manifold.trustworthiness` in :pr:`27250` by :user:`Yao Xiao <Charlie-XIAO>`;
- :func:`manifold.spectral_embedding` in :pr:`27240` by :user:`Yao Xiao <Charlie-XIAO>`;
- :func:`metrics.pairwise_distances` in :pr:`27250` by :user:`Yao Xiao <Charlie-XIAO>`;
- :func:`metrics.pairwise_distances_chunked` in :pr:`27250` by
:user:`Yao Xiao <Charlie-XIAO>`;
- :func:`metrics.pairwise.pairwise_kernels` in :pr:`27250` by
:user:`Yao Xiao <Charlie-XIAO>`;
- :func:`sklearn.utils.multiclass.type_of_target` in :pr:`27274` by
:user:`Yao Xiao <Charlie-XIAO>`.
**Classes:**
- :class:`cluster.HDBSCAN` in :pr:`27250` by :user:`Yao Xiao <Charlie-XIAO>`;
- :class:`cluster.KMeans` in :pr:`27179` by :user:`Nurseit Kamchyev <Bncer>`;
- :class:`cluster.MiniBatchKMeans` in :pr:`27179` by :user:`Nurseit Kamchyev <Bncer>`;
- :class:`cluster.OPTICS` in :pr:`27104` by
:user:`Maren Westermann <marenwestermann>` and in :pr:`27250` by :user:`Yao Xiao <Charlie-XIAO>`;
- :class:`decomposition.NMF` in :pr:`27100` by :user:`Isaac Virshup <ivirshup>`;
- :class:`decomposition.MiniBatchNMF` in :pr:`27100` by
:user:`Isaac Virshup <ivirshup>`;
- :class:`feature_extraction.text.TfidfTransformer` in :pr:`27219` by
:user:`Yao Xiao <Charlie-XIAO>`;
- :class:`cluster.Isomap` in :pr:`27250` by :user:`Yao Xiao <Charlie-XIAO>`;
- :func:`manifold.SpectralEmbedding` in :pr:`27240` by :user:`Yao Xiao <Charlie-XIAO>`;
- :class:`manifold.TSNE` in :pr:`27250` by :user:`Yao Xiao <Charlie-XIAO>`;
- :class:`impute.SimpleImputer` in :pr:`27277` by :user:`Yao Xiao <Charlie-XIAO>`;
- :class:`impute.IterativeImputer` in :pr:`27277` by :user:`Yao Xiao <Charlie-XIAO>`;
- :class:`impute.KNNImputer` in :pr:`27277` by :user:`Yao Xiao <Charlie-XIAO>`;
- :class:`kernel_approximation.PolynomialCountSketch` in :pr:`27301` by
:user:`Lohit SundaramahaLingam <lohitslohit>`;
- :class:`neural_network.BernoulliRBM` in :pr:`27252` by
:user:`Yao Xiao <Charlie-XIAO>`;
- :class:`preprocessing.PolynomialFeatures` in :pr:`27166` by
:user:`Mohit Joshi <work-mohit>`.

@Charlie-XIAO
Copy link
Contributor Author
Charlie-XIAO commented Nov 12, 2023

One last thing: could you add an entry in this section for 1.4's changelog? :)

I’m thinking that, I haven’t modified a single line in the source code, which means that sparse arrays are originally supported and not a new feature in this case. As far as I’m concerned, the functions and classes in that section of changelog did not support sparse array previously, either because they were using .dot for sparse matrix multiplication or some more complex reasons.

Please let me know if this is not the case :)

Copy link
Member
@jjerphan jjerphan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then LGTM after a green CI.

For some estimators supporting sparse matrices, sparse arrays were supported implicitly.

I thought this section in the changelog was added so that we can report the support of sparse arrays explicitly for all the interfaces covered by the tests, even for the ones which have been supporting them implicitly.

Probably the changelog entry needs to be clarified?

Anyway, thank you, @Charlie-XIAO. :)

@Charlie-XIAO
Copy link
Contributor Author

Oh wait a minute @jjerphan, I think there are failing CIs. Probably it is because changing assert_array_almost_equal to assert_allclose? I'm not sure about the difference between these two.

@jjerphan
Copy link
Member

Feel free to revert this change, we can remove this old, deprecated interface as part of another PR.

@Charlie-XIAO
Copy link
Contributor Author

Okay I see, thanks for the response! Though I may have to do that a little bit later.

@jjerphan
Copy link
Member

Yes, no pressure. :)

It is worth enjoying life on weekends.

@jjerphan jjerphan added the Waiting for Second Reviewer First reviewer is done, need a second one! label Nov 13, 2023
@glemaitre glemaitre self-requested a review November 18, 2023 14:55
Copy link
Member
@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @Charlie-XIAO

@glemaitre glemaitre enabled auto-merge (squash) November 18, 2023 15:11
@glemaitre glemaitre merged commit 9e8f10e into scikit-learn:main Nov 18, 2023
@Charlie-XIAO Charlie-XIAO deleted the tst-sp-svm-sparse branch December 12, 2023 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0