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

[REF] refactor group_sparse_covariance #4899

Merged
merged 2 commits into from
Dec 6, 2024

Conversation

Remi-Gau
Copy link
Collaborator

@Remi-Gau Remi-Gau commented Dec 5, 2024

Changes proposed in this pull request:

  • refactor group_sparse_covariance
  • extract several functions to make code more readable

suffix = f" variation (max norm): {max_norm:.3e} "
else:
suffix = ""
if verbose > 1:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this if block can be removed as the log function will directly handle the verbose level

np.dot(W[..., k], W_inv[..., k]),
np.eye(W_inv[..., k].shape[0]),
decimal=10,
)
if debug:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

there are a lot of those debug statement that in my opinion should not be there

once more of this code has been refactored it may be easier to replace them with proper tests

Copy link
Member

Choose a reason for hiding this comment

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

Indeed.

Copy link
Contributor

github-actions bot commented Dec 5, 2024

👋 @Remi-Gau 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.

Copy link

codecov bot commented Dec 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.72%. Comparing base (b7c94a0) to head (3a8dd08).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4899      +/-   ##
==========================================
+ Coverage   93.69%   93.72%   +0.03%     
==========================================
  Files         137      137              
  Lines       17133    17146      +13     
  Branches     2948     2946       -2     
==========================================
+ Hits        16052    16070      +18     
+ Misses        573      569       -4     
+ Partials      508      507       -1     
Flag Coverage Δ
macos-latest_3.10_test_plotting 93.24% <100.00%> (+0.03%) ⬆️
macos-latest_3.11_test_plotting 93.24% <100.00%> (+0.03%) ⬆️
macos-latest_3.12_test_plotting 93.24% <100.00%> (+0.03%) ⬆️
macos-latest_3.13_test_plotting 93.24% <100.00%> (+0.03%) ⬆️
macos-latest_3.9_test_plotting 93.22% <100.00%> (+0.03%) ⬆️
ubuntu-latest_3.10_test_plotting 93.24% <100.00%> (+0.03%) ⬆️
ubuntu-latest_3.11_test_plotting 93.24% <100.00%> (+0.03%) ⬆️
ubuntu-latest_3.12_test_plotting 93.24% <100.00%> (+0.03%) ⬆️
ubuntu-latest_3.13_test_plotting 93.24% <100.00%> (+0.03%) ⬆️
ubuntu-latest_3.13_test_pre 93.26% <100.00%> (+0.03%) ⬆️
ubuntu-latest_3.9_test_min 69.49% <100.00%> (+0.05%) ⬆️
ubuntu-latest_3.9_test_plot_min 92.12% <100.00%> (+0.03%) ⬆️
ubuntu-latest_3.9_test_plotting 93.22% <100.00%> (+0.03%) ⬆️
windows-latest_3.10_test_plotting 93.21% <100.00%> (+0.03%) ⬆️
windows-latest_3.11_test_plotting 93.21% <100.00%> (+0.03%) ⬆️
windows-latest_3.12_test_plotting 93.21% <100.00%> (+0.03%) ⬆️
windows-latest_3.13_test_plotting 93.21% <100.00%> (+0.03%) ⬆️
windows-latest_3.9_test_plotting 93.20% <100.00%> (+0.03%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Thx for looking at that one.

np.dot(W[..., k], W_inv[..., k]),
np.eye(W_inv[..., k].shape[0]),
decimal=10,
)
if debug:
Copy link
Member

Choose a reason for hiding this comment

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

Indeed.

@Remi-Gau Remi-Gau marked this pull request as ready for review December 6, 2024 08:17
@Remi-Gau Remi-Gau requested a review from man-shu December 6, 2024 08:17
Copy link
Contributor

@man-shu man-shu left a comment

Choose a reason for hiding this comment

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

Just found a typo, otherwise LGTM!

Co-authored-by: Himanshu Aggarwal <himanshuaggarwal1997@gmail.com>
@Remi-Gau Remi-Gau merged commit c4258e9 into nilearn:main Dec 6, 2024
33 of 34 checks passed
@Remi-Gau Remi-Gau deleted the ref/_group_sparse_covariance branch December 9, 2024 08:17
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.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy