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

[ENH] Add ability to re-run ICA when no BOLD components are found #663

Merged
merged 9 commits into from
Jan 28, 2021

Conversation

tsalo
Copy link
Member

@tsalo tsalo commented Jan 26, 2021

Closes #662. This is just a first pass, although I think it should work.

Changes proposed in this pull request:

  • Re-run ICA (within constraints of maxrestarts parameter) when no BOLD components are found by the decision tree.

@tsalo
Copy link
Member Author

tsalo commented Jan 26, 2021

It looks like it's working! The four-echo test has an ICA that converges nicely each time, but fails to detect any BOLD components for the first three decompositions. On the fourth one, it finds BOLD components! 🎉

One unfortunate thing is that the logs say "ICA attempt 1" for each version. Not sure the cleanest way to fix that though.

@tsalo
Copy link
Member Author

tsalo commented Jan 26, 2021

I will go through and update the outputs later but I'm going to mark this as ready for review now. If anyone has any ideas on how best to log the number of attempts and/or updated random seeds, please review.

@tsalo tsalo marked this pull request as ready for review January 26, 2021 19:05
@jbteves
Copy link
Collaborator

jbteves commented Jan 26, 2021

LGR.warning('ICA attempt {0} failed to converge after {1} '
'iterations'.format(i_attempt + 1, ica.n_iter_))

Let's just not log the attempt number. Maybe just print seed and indicate success/failure at end?

@eurunuela
Copy link
Collaborator

I like the changes. I'd like to see Josh's suggestion added and the failing test passing.

@codecov
Copy link

codecov bot commented Jan 26, 2021

Codecov Report

Merging #663 (c8a09d5) into master (dd513ae) will decrease coverage by 0.10%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #663      +/-   ##
==========================================
- Coverage   93.50%   93.39%   -0.11%     
==========================================
  Files          26       26              
  Lines        2016     2029      +13     
==========================================
+ Hits         1885     1895      +10     
- Misses        131      134       +3     
Impacted Files Coverage Δ
tedana/decomposition/ica.py 82.75% <66.66%> (ø)
tedana/workflows/tedana.py 89.82% <88.88%> (-0.62%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd513ae...c8a09d5. Read the comment docs.

eurunuela
eurunuela previously approved these changes Jan 26, 2021
Copy link
Collaborator

@eurunuela eurunuela 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 think it is a very simple yet effective solution. We can always complicate things more. Thank you @tsalo

Copy link
Collaborator

@jbteves jbteves 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 @tsalo !

@tsalo
Copy link
Member Author

tsalo commented Jan 26, 2021

We can revisit the minimum number of BOLD components we want to enforce at some point in the future, but I'm happy with the general approach. Given that we have two approving reviews, I think I'll merge this EOD Thursday if there are no other reviews, to give the other devs a chance to take a look.

@@ -64,16 +66,16 @@ def tedica(data, n_components, fixed_seed, maxit=500, maxrestart=10):

w = list(filter(lambda i: issubclass(i.category, UserWarning), w))
if len(w):
LGR.warning('ICA attempt {0} failed to converge after {1} '
'iterations'.format(i_attempt + 1, ica.n_iter_))
LGR.warning('ICA with random seed {0} failed to converge after {1} '
Copy link
Member

Choose a reason for hiding this comment

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

Since we're updating this user-facing behavior, we should make sure it's noted somewhere (maybe in the release notes ?).

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think release notes should be okay for this. It's not a significant change.

Copy link
Member

@emdupre emdupre Jan 27, 2021

Choose a reason for hiding this comment

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

I know when I used to run tedana more I would watch the logs, so I worry it could scare those users (is why I do want it mentioned somewhere). I know it would have scared me ! 😅

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's completely fair. Any thoughts on where to put it aside from release notes? When we do next release we could package it with the newsletter, too.

Copy link
Member Author

Choose a reason for hiding this comment

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

We could downgrade this from a warning to a debug in a separate PR?

Copy link
Member

Choose a reason for hiding this comment

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

In general I was thinking that we don't have a descriptive whatsnew. Maybe we could consider starting one ?

For now, I think the release notes are fine ! And I always like the newsletter's summaries :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I actually disagree with downgrading to a debug. I've noticed that failure to converge tends to go along with lower-quality data, so I think it's good to let the user know that the software is struggling a bit.
Would you mind opening an issue for a whatsnew @emdupre ? That sounds like a good idea to me, especially if we're planning on increasing the release speed.

@tsalo tsalo merged commit cd59211 into ME-ICA:master Jan 28, 2021
@tsalo tsalo deleted the enh/restart-bad-decomps branch January 28, 2021 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change WIll make a non-trivial change to outputs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to re-run ICA when no/few BOLD components are found
5 participants