Skip to content
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

[MAINT] Update some missed tests and examples to use new standardize strategy to silence warnings #3821

Merged
merged 9 commits into from Jul 11, 2023

Conversation

ymzayek
Copy link
Member

@ymzayek ymzayek commented Jul 6, 2023

Follow-up to #3720 and Closes #3719 .

Changes proposed in this pull request:

@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2023

👋 @ymzayek Thanks for creating a PR!

Until this PR is ready for review, you can include the [WIP] tag in its title, or leave it as a github draft.

Please make sure it is compliant with our contributing guidelines. In particular, be sure it checks the boxes listed below.

  • PR has an interpretable title.
  • PR links to Github issue with mention Closes #XXXX (see our documentation on PR structure)
  • Code is PEP8-compliant (see our documentation on coding style)
  • Changelog or what's new entry in doc/changes/latest.rst (see our documentation on PR structure)

For new features:

  • There is at least one unit test per new function / class (see our documentation on testing)
  • The new feature is demoed in at least one relevant example.

For bug fixes:

  • There is at least one test that would fail under the original bug conditions.

We will review it as quick as possible, feel free to ping us with questions if needed.

@codecov
Copy link

codecov bot commented Jul 7, 2023

Codecov Report

Merging #3821 (ef983f4) into main (787d662) will increase coverage by 0.00%.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #3821   +/-   ##
=======================================
  Coverage   91.53%   91.53%           
=======================================
  Files         133      133           
  Lines       15600    15623   +23     
  Branches     3246     3250    +4     
=======================================
+ Hits        14279    14301   +22     
  Misses        774      774           
- Partials      547      548    +1     
Flag Coverage Δ
macos-latest_3.10 91.46% <ø> (+<0.01%) ⬆️
macos-latest_3.11 ?
macos-latest_3.8 ?
macos-latest_3.9 ?
ubuntu-latest_3.10 91.46% <ø> (+<0.01%) ⬆️
ubuntu-latest_3.11 91.46% <ø> (+<0.01%) ⬆️
ubuntu-latest_3.8 91.42% <ø> (+<0.01%) ⬆️
ubuntu-latest_3.9 91.42% <ø> (+<0.01%) ⬆️
windows-latest_3.10 ?
windows-latest_3.11 91.40% <ø> (+<0.01%) ⬆️
windows-latest_3.8 91.36% <ø> (+<0.01%) ⬆️
windows-latest_3.9 91.36% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 13 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ymzayek
Copy link
Member Author

ymzayek commented Jul 7, 2023

One issue with silencing all instances of this warning in our examples gallery is that the ones that are still throwing the warning come from the functions plot_carpet and ConnectivityMeasure.fit_transform which call signal.clean with the parameter standardize equal to True or "zscore" internally so these are not exposed to the user. Hence the warning doesn't make sense for these cases as the user has no control and cannot call the new behavior. Probably best to open a new issue to see how to resolve this. Might need to add a deprecated parameter to allow the user to access the new behavior with these functions.

The relevant lines are:

signal._standardize(x, detrend=False, standardize=True)

and
data = clean(data, t_r=t_r, detrend=True, standardize='zscore')

@ymzayek ymzayek marked this pull request as ready for review July 7, 2023 12:18
@Remi-Gau
Copy link
Collaborator

Remi-Gau commented Jul 7, 2023

One issue with silencing all instances of this warning in our examples gallery is that the ones that are still throwing the warning come from the functions plot_carpet and ConnectivityMeasure.fit_transform which call signal.clean with the parameter standardize equal to True or "zscore" internally so these are not exposed to the user. Hence the warning doesn't make sense for these cases as the user has no control and cannot call the new behavior. Probably best to open a new issue to see how to resolve this. Might need to add a deprecated parameter to allow the user to access the new behavior with these functions.

Sounds good to me and thanks for tracking the source of all those warnings!

Copy link
Member

@bthirion bthirion left a comment

Choose a reason for hiding this comment

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

LGTM overall.

nilearn/tests/test_signal.py Show resolved Hide resolved
nilearn/tests/test_signal.py Show resolved Hide resolved
Copy link
Member

@bthirion bthirion left a comment

Choose a reason for hiding this comment

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

LGTM, thx.

@ymzayek ymzayek merged commit 39c6dcb into nilearn:main Jul 11, 2023
29 checks passed
@ymzayek ymzayek deleted the standardize-param branch July 11, 2023 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update examples to use "zscore_sample" standardize strategy
3 participants