8000 TST Extend tests for `scipy.sparse.*array` in `sklearn/utils/tests/test_sparsefuncs.py` by Tialo · Pull Request #27242 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
8000

TST Extend tests for scipy.sparse.*array in sklearn/utils/tests/test_sparsefuncs.py #27242

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 2 commits into from
Sep 13, 2023

Conversation

Tialo
Copy link
Contributor
@Tialo Tialo commented Aug 30, 2023

Reference Issues/PRs

Towards #27090.

What does this implement/fix? Explain your changes.

Any other comments?

In tests like test_mean_variance_axis0 I checked if *array will work with *matrix. If you think that we should check matrices only with matrices, same for arrays, I can reformat parameterisations using zip

@github-actions
Copy link
github-actions bot commented Aug 30, 2023

✔️ Linting Passed

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

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

Comment on lines 444 to 452
sp.hstack(
[
csr_container(np.full((13, 1), fill_value=np.nan)),
sp.random(13, 1, density=0.8, random_state=42),
],
format="csr",
),
)
for csr_container in CSR_CONTAINERS
Copy link
Member

Choose a reason for hiding this comment

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

Due to the call to sp.hstack, we whill always return a sparse matrix.
The random in the previous tuple is also only testing sparse matrices.

One potential solution is to create sparse matrices, and parametrize with CSR_CONTAINER and intenally cast X1 and X2:

X1 = csr_container(X1)
X2 = csr_container(X2)

@glemaitre
Copy link
Member

Otherwise, LGTM for the rest.

@Tialo
Copy link
Contributor Author
Tialo commented Sep 12, 2023

@glemaitre I removed csr_container in first part of parameterisation and left just np.full if it becomes sparse matrix anyway

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 @Tialo.
Another ready @OmarManzoor

Copy link
Contributor
@OmarManzoor OmarManzoor 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 @Tialo

@OmarManzoor OmarManzoor merged commit 9700ebf into scikit-learn:main Sep 13, 2023
@Tialo Tialo deleted the tests/test_sparsefuncs branch September 13, 2023 10:19
REDVM pushed a commit to REDVM/scikit-learn that referenced this pull request Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0