Skip to content

TST Extend tests for scipy.sparse.*array in sklearn/impute/tests/test_impute.py#27208

Merged
glemaitre merged 3 commits intoscikit-learn:mainfrom
Tialo:tests/test_impute
Sep 13, 2023
Merged

TST Extend tests for scipy.sparse.*array in sklearn/impute/tests/test_impute.py#27208
glemaitre merged 3 commits intoscikit-learn:mainfrom
Tialo:tests/test_impute

Conversation

@Tialo
Copy link
Copy Markdown
Contributor

@Tialo Tialo commented Aug 29, 2023

Reference Issues/PRs

Towards #27090.

What does this implement/fix? Explain your changes.

Any other comments?

Function(not test) _check_statistics used csc_matrix, and was used in 3 tests, so i parameterised them.

Tests test_missing_indicator_new and test_missing_indicator_sparse_param were little tricky to parameterise, if you have any other smooth solution, I will be glad to hear it.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Aug 29, 2023

✔️ Linting Passed

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

Generated for commit: 5b26675. Link to the linter CI: here

Copy link
Copy Markdown
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

def test_missing_indicator_new(
missing_values, arr_type, dtype, param_features, n_features, features_indices
):
if missing_values == 0 and arr_type is not np.array:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Even though this if condition does seem a bit awkward, I think it looks okay. Let's see if another maintainer has a better idea.

@glemaitre glemaitre self-requested a review September 13, 2023 19:44
Copy link
Copy Markdown
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. I prefer to filter while generating the cases in the parametrization instead of filtering in the test.

@glemaitre glemaitre enabled auto-merge (squash) September 13, 2023 20:06
@Tialo
Copy link
Copy Markdown
Contributor Author

Tialo commented Sep 13, 2023

@glemaitre test_missing_indicator_sparse_param did not have bsr matrix. Are you sure we need to add it in parameterization?

@glemaitre
Copy link
Copy Markdown
Member

test_missing_indicator_sparse_param did not have bsr matrix. Are you sure we need to add it in parameterization?

Since it was used in the other parametrization, we can put it here. This should be fine (at least it was passing locally). Usually whatever is not CSR, CSC will be converted to one of those two.

@glemaitre glemaitre merged commit a25cc04 into scikit-learn:main Sep 13, 2023
@Tialo Tialo deleted the tests/test_impute branch September 13, 2023 21:34
REDVM pushed a commit to REDVM/scikit-learn that referenced this pull request Nov 16, 2023
…est_impute.py` (scikit-learn#27208)

Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
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