Repository navigation
Closed
Labels
Meta-issueGeneral issue associated to an identified list of tasksSprintgood first PR to reviewSimple atomic PR to reviewmodule:test-suiteeverything related to our tests
Description
SciPy sparse matrices (i.e. scipy.sparse.*matrix) are tested but their sparse arrays counterpart (i.e. scipy.sparse.*array) aren't yet will become ubiquitous (see #26418).
Tests and their parameterizations (when they exist) must be adapted to include scipy.sparse.*array conditionally to versions of SciPy that support them (i.e. scipy>=1.8).
Steps
ℹ️ You can take #27095 as an example for your PRs.
1. Choose one of the files to adapt
- Indicate the file you are adapting (later referred to as
<filename>) on this issue so no-one ends up duplicating work. E.g.
Hi, I am starting working on `<filename>`.
Please double check as this list might be outdated, but candidate files might be:
- TST Extend tests for
scipy.sparse.*arrayintest_glm.py#27107 - TST Extend tests for
scipy.sparse.*arrayinsklearn/cluster/tests/test_affinity_propagation#27095 - TST Extend tests for
scipy.sparse.*arrayinsklearn/cluster/tests/test_bicluster.py#27093 - TST Extend tests for
scipy.sparse.*arrayinsklearn/cluster/tests/test_bisect_k_means.py#27099 - TST Extend tests for
scipy.sparse.*arrayintest_nmf.py#27100 - TST Extend tests for
scipy.sparse.*arrayinsklearn/svm/tests/test_bounds.py#27121 - TST Extend tests for
scipy.sparse.*arrayinsklearn/cluster/tests/test_hdbscan.py#27116 - TST Extend tests for
scipy.sparse.*arrayinsklearn/cluster/tests/test_dbscan.py+test_birch.py+test_column_transformer.py#27097 - TST Extend tests for
scipy.sparse.*arrayinsklearn/svm/tests/test_svm.py#27128 - TST Extend tests for
scipy.sparse.*arrayinsklearn/decomposition/tests/test_incremental_pca.py#27131 - TST Extend tests for
scipy.sparse.*arrayinsklearn/linear_model/tests/test_linear_loss.py#27133 - TST Extend tests for
scipy.sparse.*arrayinsklearn/decomposition/tests/test_kernel_pca.py#27143 - TST Extend tests for
scipy.sparse.*arrayinsklearn/decomposition/tests/test_online_lda.py#27144 - TST Extend tests for
scipy.sparse.*arrayinsklearn/ensemble/tests/test_weight_boosting.py#27148 - TST Extend tests for
scipy.sparse.*arrayinsklearn/decomposition/tests/test_pca.py#27150 - TST Extend tests for
scipy.sparse.*arrayinsklearn/neighbors/tests/test_nearest_centroid.py#27132 - TST Extend tests for
scipy.sparse.*arrayinsklearn/cluster/tests/test_hierarchical.py#27101 - TST Extend tests for
scipy.sparse.*arrayinsklearn/linear_model/tests/test_perceptron.py#27160 - TST Extend tests for
scipy.sparse.*arrayintest_lof.py#27162 - TST Extend tests for
scipy.sparse.*arrayintest_mlp.py#27163 - TST Extend tests for
scipy.sparse.*arrayinsklearn/tests/test_multioutput.py#27171 - TST Extend tests for
scipy.sparse.*arrayinsklearn/utils/tests/test_class_weight.py#27188 - TST Extend tests for
scipy.sparse.*arrayintest_encoders.py#27289 - TST Extend tests for
scipy.sparse.*arrayinsklearn/ensemble/tests/test_bagging.py#27170 - TST Extend tests for
scipy.sparse.*arrayinsklearn/feature_selection/tests/test_mutual_info.py#27173 - TST Extend tests for
scipy.sparse.*arrayinsklearn/feature_selection/tests/test_base.py#27175 - TST Extend tests for
scipy.sparse.*arrayinsklearn/feature_selection/tests/test_chi2.py#27176 - TST Extend tests for
scipy.sparse.*arrayinsklearn/feature_selection/tests/test_rfe.py#27177 - TST Extend tests for
scipy.sparse.*arrayinsklearn/feature_selection/tests/test_sequential.py#27178 - TST Extend tests for
scipy.sparse.*arrayinsklearn/utils/tests/test_utils.py#27201 - TST Extend tests for
scipy.sparse.*arrayinsklearn/utils/tests/test_set_output.py#27202 - TST Extend tests for
scipy.sparse.*arrayinsklearn/linear_model/tests/test_sag.py#27206 - TST Extend tests for
scipy.sparse.*arrayinsklearn/impute/tests/test_impute.py#27208 - TST Extend tests for
scipy.sparse.*arrayinsklearn/linear_model/tests/test_logistic.py#27210 - TST Extend tests for
scipy.sparse.*arrayinsklearn/linear_model/tests/test_huber.py#27211 - TST Extend tests for
scipy.sparse.*arrayinsklearn/metrics/tests/test_ranking.py#27212 - TST Extend tests for
scipy.sparse.*arrayinsklearn/tests/test_naive_bayes.py#27213 - TST Extend tests for
scipy.sparse.*arrayinsklearn/ensemble/tests/test_stacking.py#27214 - TST Extend tests for
scipy.sparse.*arrayinsklearn/tests/test_dummy.py#27215 - TST Extend tests for
scipy.sparse/*arrayinsklearn/ensemble/tests/test_forest#27216 - TST Extend tests for
scipy.sparse/*arrayinsklearn/ensemble/tests/test_gradient_boosting#27217 - TST Extend tests for
scipy.sparse/*arrayinsklearn/ensemble/tests/test_iforest#27218 - TST Extend tests for
scipy.sparse/*arrayinsklearn/feature_extraction/tests/test_text#27219 - TST Extend tests for
scipy.sparse.*arrayinsklearn/datasets/tests/test_svmlight_format.py#27220 - TST Extend tests for
scipy.sparse.*arrayinsklearn/manifold/tests/test_t_sne.py#27221 - TST Extend tests for
scipy.sparse/*arrayinsklearn/feature_selection/tests/test_variance_threshold#27222 - TST Extend tests for
scipy.sparse.*arrayinsklearn/tests/test_multiclass.py#27223 - TST Extend tests for
scipy.sparse.*arrayinsklearn/tree/tests/test_monotonic_tree.py#27224 - TST Extend tests for
scipy.sparse/*arrayinsklearn/linear_model/tests/test_base#27225 - TST Extend tests for
scipy.sparse/*arrayinsklearn/linear_model/tests/test_coordinate_descent#27226 - TST Extend tests for
scipy.sparse.*arrayinsklearn/preprocessing/tests/test_label.py#27227 - TST Extend tests for
scipy.sparse/*arrayinsklearn/linear_model/tests/test_quantile#27228 - TST Extend tests for
scipy.sparse.*arrayinsklearn/metrics/tests/test_dist_metrics.py#27229 - TST Extend tests for
scipy.sparse.*arrayinsklearn/metrics/tests/test_pairwise_distances_reduction.py#27230 - TST Extend tests for
scipy.sparse.*arrayinsklearn/metrics/tests/test_classification.py#27231 - TST Extend tests for
scipy.sparse/*arrayinsklearn/linear_model/tests/test_ransac#27233 - TST Extend tests for
scipy.sparse/*arrayinsklearn/linear_model/tests/test_ridge#27235 - TST Extend tests for
scipy.sparse/*arrayinsklearn/linear_model/tests/test_sparse_coordinate_descent#27237 - TST Extend tests for
scipy.sparse.*arrayinsklearn/feature_selection/tests/test_feature_select.py#27239 - TST Extend tests for
scipy.sparse/*arrayinsklearn/metrics/cluster/tests/test_unsupervised#27241 - TST Extend tests for
scipy.sparse.*arrayinsklearn/utils/tests/test_sparsefuncs.py#27242 - TST Extend tests for
scipy.sparse/*arrayinsklearn/model_selection/tests/test_split#27246 - TST Extend tests for
scipy.sparse/*arrayinsklearn/neural_network/tests/test_rbm#27252 - TST Extend tests for
scipy.sparse/*arrayinsklearn/preprocessing/tests/test_data#27253 - TST Extend tests for
scipy.sparse/*arrayinsklearn/preprocessing/tests/test_function_transformer#27254 - TST Extend tests for
scipy.sparse.*arrayinsklearn/tests/test_calibration.py#27257 - TST Extend tests for
scipy.sparse/*arrayinsklearn/tree/tests/test_tree#27261 - TST Extend tests for
scipy.sparse/*arrayinsklearn/utils/tests/test_extmath#27262 - TST Extend tests for
scipy.sparse.*arrayinsklearn/tests/test_kernel_ridge.py#27270 - TST Extend tests for
scipy.sparse.*arrayinsklearn/linear_model/tests/test_passive_aggressive.py#27273 - TST Extend tests for
scipy.sparse/*arrayinsklearn/utils/tests/test_multiclass#27274 - TST Extend tests for
scipy.sparse/*arrayinsklearn/utils/tests/test_testing#27276 - TST Extend tests for
scipy.sparse/*arrayinsklearn/impute/tests/test_common#27277 - TST Extend tests for
scipy.sparse.*arrayinsklearn/tests/test_pipeline.py#27278 - TST Extend tests for
scipy.sparse.*arrayinsklearn/tests/test_kernel_approximation.py#27301 - TST Extend tests for
scipy.sparse.*arrayinsklearn/utils/tests/test_mocking.py#27319 - TST Extend tests for
scipy.sparse.*arrayinsklearn/datasets/tests/test_openml.py#27323 - TST Extend tests for
scipy.sparse.*arrayinsklearn/feature_selection/tests/test_base.py#27175 - TST Extend tests for
scipy.sparse.*arrayinsklearn/manifold/tests/test_isomap.py#27341 - TST Extend tests for
scipy.sparse.*arrayinsklearn\model_selection\tests\test_search.py#27326 - TST Extend tests for
scipy.sparse.*arrayinsklearn/utils/tests/test_mocking.py#27319 - TST Extend tests for
scipy.sparse.*arrayinmodel_selection/tests/test_validation.py#27366 - TST Extend tests for
scipy.sparse/*arrayinsklearn/neighbors/tests/test_neighbors#27250 - TST Extend tests for
scipy.sparse.*arrayinsklearn/tests/test_kernel_approximation.py#27301 - TST Extend tests for
scipy.sparse.*arrayintest_pairwise.py#27288 - TST Extend tests for
scipy.sparse.*arrayinsklearn/datasets/tests/test_svmlight_format.py#27220 - TST Extend tests for
scipy.sparse.*arrayinsklearn/covariance/tests/test_graphical_lasso.py#27494 - TST Extend tests for
scipy.sparse.*arrayintest_polynomial.py#27166 - TST Extend tests for
scipy.sparse.*arrayinsklearn/metrics/tests/test_common.py#27205 - TST Extend tests for
scipy.sparse.*arrayinsklearn/preprocessing/tests/test_common.py#27164 - TST Extend tests for
scipy.sparse.*arrayinsklearn/cluster/tests/test_k_means.py#27179 - TST Extend tests for
scipy.sparse.*arrayinsklearn/cluster/tests/test_optics.py#27104 - TST Extend tests for
scipy.sparse.*arrayinsklearn/utils/tests/test_estimator_checks.py#27203 - TST Extend tests for
scipy.sparse.*arrayinsklearn/utils/tests/test_shortest_path.py#27502 - TST Extend tests for
scipy.sparse.*arrayinsklearn/utils/tests/test_seq_dataset.py#27413 - TST Extend tests for
scipy.sparse/*arrayinsklearn/manifold/tests/test_spectral_embedding#27240 - TST Extend tests for
scipy.sparse.*arrayinsklearn/tests/test_random_projection.py#27314 - TST Extend tests for
scipy.sparse.*arrayinsklearn/svm/tests/test_sparse#27723 - TST Extend tests for
scipy.sparse.*arrayinsklearn/cluster/tests/test_spectral.py#27161 - FIX make 'array-like' reject sparse containers in parameter validation #28101
- TST Extend tests for
scipy.sparse.*arrayinsklearn/utils/_testing.py#27847
2. Perform the following (non-exhaustive) changes for <filename>
- Add test parametrization for tests using
*_matrix(for instance see eda7b16) - Adapt existing test parametrization to test against sparse array (for instance see 6717f99)
- Extend or add test checking that type of sparse containers are preserve by functions. E.g. adding tests like (as proposed by TST Extend tests for
scipy.sparse.*array#27090 (comment)):sparse_input = sparse_container(...) sparse_output = process_sparse_container(sparse_input) assert isinstance(sparse_output, type(sparse_input))
- Run tests for this file:
# Run all the test in <filename> pytest <filename> -k test_to_run # Run a specific test in this file pytest <filename> -k test_to_run - If tests fail, the tested implementations has to be adapted (let us know if you need help)
3. Create a pull request
- Use this title:
TST Extend tests for `scipy.sparse.*array` in `<filename>`
- Mention this issue in its description:
Towards #27090.
4. Once the pull request is created
- Ignore the error on the CI related the changelog: those PR need not update the changelog since nothing has changed for the users (until this issue is resolved), and maintainers must label PRs as "No Changelog Needed" for the check to be deactivated.
Reacted by Stefan van der Walt
Metadata
Metadata
Assignees
Labels
Meta-issueGeneral issue associated to an identified list of tasksSprintgood first PR to reviewSimple atomic PR to reviewmodule:test-suiteeverything related to our tests
Activity
jjerphan commentedon Aug 18, 2023
Hi, I am starting working on
sklearn/cluster/tests/test_affinity_propagation.py.[-]TST Extend test for `scipy.sparse.*array`[/-][+]TST Extend tests for `scipy.sparse.*array`[/+]msgomez06 commentedon Aug 18, 2023
Hi! I'm starting work on
sklearn/cluster/tests/test_dbscan.pymsgomez06 commentedon Aug 18, 2023
Hi! I'm starting work on
sklearn/cluster/tests/test_birch.pyKislovskiy commentedon Aug 18, 2023
Hi, I am starting working on
sklearn/cluster/tests/test_bisect_k_means.py.marenwestermann commentedon Aug 18, 2023
Working on
sklearn/cluster/tests/test_optics.pyvvkrddy commentedon Aug 18, 2023
I am working on
sklearn/cluster/tests/test_hierarchical.py.Kislovskiy commentedon Aug 18, 2023
I am working on
sklearn/cluster/tests/test_k_means.py.ivirshup commentedon Aug 18, 2023
@jjerphan I think we should add a step for testing that types are maintained in cases where a sparse array can be returned. E.g.:
jjerphan commentedon Aug 18, 2023
Indeed; thanks for mentioning that, @ivirshup. I updated the issue's description accordingly.
ivirshup commentedon Aug 18, 2023
If we have to modify the code to support the
*_arrayclasses, is this considered a fix or a feature? Wondering where this goes in the changelog.jjerphan commentedon Aug 18, 2023
I would consider this support and an enhancement, I think.
157 remaining items
work-mohit commentedon Oct 1, 2023
jjerphan commentedon Nov 12, 2023
After a brief discussion with @Charlie-XIAO in #27723 (comment), we might want to clarify the changelog entry which has been introduced to clarify explicitly that all the interfaces supporting sparse matrices now explicitly support sparse areays.
What do you think?
StefanieSenger commentedon Nov 12, 2023
I agree, with modifying the tests, the support for sparse arrays is made sure, but not introduced. Changing this phrase from the changelog maybe, into "now tested to support SciPy sparse array"?
Several estimators are now supporting SciPy sparse arrays. The following functions and classes are impacted:jjerphan commentedon Nov 12, 2023
When this issue is closed, I think we can adapt the changelog entry to mention that all interfaces supporting sparse matrices now support sparse arrays (potentially removing the enumeration of interfaces if it is too verbose).
What do you think? Is this sufficient?
y-vectorfield commentedon Nov 18, 2023
Hello, I will be starting working on sklearn/utils/_testing.py.
@jjerphan, CC) @norbusan, this is my first contribution for sklearn.
If I meet with trouble, can you advise me??
jjerphan commentedon Nov 18, 2023
Hello @y-vectorfield,
Thank you. Yes, we will be there to help you.
y-vectorfield commentedon Nov 26, 2023
Hello, @jjerphan,
I modified tests in sklearn/utils/_testing.py and submitted a draft version of PR(#27847).
I have two questions.
First: Is my modification correct?
I modified the codes as follows.
https://github.com/scikit-learn/scikit-learn/pull/27847/files
Second: I could not test using pytest.
I implemented the modified codes, however, I could not run the tests...
wmin401 commentedon Feb 19, 2024
I made PRs on sklearn/utils/tests/test_param_validation.py #27317.
I am first-timer and it is my first PRs. I would appreciate it if you give me a advice with my PRs.
I extended the existing test to cover scipy.sparse.*array objects and changed the parameter validation from sparse container where necessary.
Here is my PRs below:
#28456
Charlie-XIAO commentedon Feb 19, 2024
@wmin401 I'm sorry but there is #27950 open for that file already. I'm afraid there are no more tasks left for this issue.
Perhaps @jjerphan the "good first issue" tag should be removed now?
Charlie-XIAO commentedon Feb 28, 2024
The last PRs have been merged. Thanks a lot everyone!
@jjerphan I think all tasks here are completed. Should we close now?
jjerphan commentedon Feb 28, 2024
Thank you for the heads-up, @Charlie-XIAO !
I will take some time to double-check it before we close it as completed.
jjerphan commentedon Mar 1, 2024
Everything looks good to me.
Thank you everyone for your involvement!