Skip to content

Calculate dependence metrics for modified mixing matrices and confounds - #1350

Open
tsalo wants to merge 18 commits into
ME-ICA:mainfrom
tsalo:mir-metrics
Open

Calculate dependence metrics for modified mixing matrices and confounds#1350
tsalo wants to merge 18 commits into
ME-ICA:mainfrom
tsalo:mir-metrics

Conversation

@tsalo

@tsalo tsalo commented Feb 6, 2026

Copy link
Copy Markdown
Member

Closes #1300 and closes #1341.

Changes proposed in this pull request:

  • Run generate_metrics on the following:
    • The orthogonalized mixing matrix if --tedort is enabled.
    • The post-MIR mixing matrix if --gscontrol mir is enabled.
    • Any external regressors provided by the user.
    • The gsr and mir time series if --gscontrol gsr and/or mir are enabled.
  • Add use_multivariate argument to generate_metrics. It should be true for mixing matrices and false for external regressors and confounds. It shouldn't matter for PCA, since orthogonal components should produce the same component weights whether or not a multivariate model is used.

@tsalo tsalo added the enhancement issues describing possible enhancements to the project label Feb 6, 2026
@codecov

codecov Bot commented Feb 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.36%. Comparing base (85fab4f) to head (a8b4113).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
tedana/metrics/dependence.py 81.48% 4 Missing and 1 partial ⚠️
tedana/metrics/collect.py 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1350      +/-   ##
==========================================
+ Coverage   90.28%   90.36%   +0.08%     
==========================================
  Files          30       30              
  Lines        4712     4776      +64     
  Branches      784      791       +7     
==========================================
+ Hits         4254     4316      +62     
- Misses        309      312       +3     
+ Partials      149      148       -1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tsalo
tsalo marked this pull request as ready for review February 7, 2026 17:50
@tsalo

tsalo commented Feb 7, 2026

Copy link
Copy Markdown
Member Author

I can work on the test coverage once we decide if we want to move forward with this.

LGR.info("Generating metrics for TEDORT-orthogonalized mixing matrix")
orig_verbose = io_generator.verbose
io_generator.verbose = False
orth_component_table, _ = metrics.collect.generate_metrics(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

One thing I learned from trying out this branch on real data is that the dependence metrics will change only for accepted components when using the orthogonalized mixing matrix. Given how orthogonalization is meant to be used (i.e., you would do denoising using only the orthogonalized rejected components), it might make more sense to calculate the dependence metrics on a mixing matrix that only contains the orthogonalized rejected components.

@tsalo tsalo Feb 9, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I tried generating the metrics using just the orthogonalized rejected components, and the dependence metrics stayed the same as the original values for those components! I'm a little surprised.

@tsalo

tsalo commented Feb 9, 2026

Copy link
Copy Markdown
Member Author

Would figures like this be useful to anyone?

image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement issues describing possible enhancements to the project

Projects

None yet

1 participant