-
Notifications
You must be signed in to change notification settings - Fork 95
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] Reorganize selcomps and fitmodels_direct #266
Conversation
- Rename fitmodels_direct to dependence_metrics - Split sel_comps into manual_selection, kundu_selection_v2, and kundu_metrics - Move kundu_metrics into model.fit - Rename selcomps to tedica - Rename PCA-derived variance explained column in PCA component table. This will no longer overwrite the one from fitmodels_direct - Add reorder_dataframe function to selection._utils
Codecov Report
@@ Coverage Diff @@
## master #266 +/- ##
=========================================
+ Coverage 46.16% 49.1% +2.93%
=========================================
Files 35 37 +2
Lines 2060 2122 +62
=========================================
+ Hits 951 1042 +91
+ Misses 1109 1080 -29
Continue to review full report at Codecov.
|
# Conflicts: # tedana/decomposition/eigendecomp.py # tedana/selection/__init__.py
# Conflicts: # tedana/selection/select_comps.py # tedana/workflows/tedana.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this, @tsalo ! I did a first pass review. Still have a few questions that it'd be great to confirm !
|
||
tedana.model.fit | ||
|
||
:mod:`tedana.combine`: Combining time series across echoes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you have combine
, but below you've replaced it with model
. We should harmonize.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just reordered them based on when they occur in the workflow. It's possible that I missed some changes though, so I apologize if that's adding to the confusion.
|
||
:template: module.rst | ||
|
||
tedana.combine | ||
tedana.model.fit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that we want to call this a .fit
, since it could be easily confused with the sklearn convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've never liked fit
either. We can change tedana.model
to tedana.metrics
(as you suggested above), but we'll still need a file below that in order to keep model/metrics as a subfolder-organized submodule. I fully expect us to expand our sets of metrics (e.g., with AROMA-like motion- and artifact-based ones), which is why I don't think we should just put it in one top-level file (i.e., tedana/metrics.py
), but that still leaves us with the issue of what to name the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're not quite there yet (e.g., adding motion based metrics), though, I think we should just keep it in a top-level file for now -- we can expand when we add more. WDYT ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, #273 moves the two remaining functions (get_coeffs
and computefeats2
) in model.fit
into a new stats module, so the only things in model.fit
will be the metrics (dependence_metrics
and kundu_metrics
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can move it there then. So, tedana/model/fit.py
will become tedana/model.py
and the tedana/model/
folder will be removed. Does that sound good?
tedana/decomposition/pca.py
Outdated
reindex=False, mmixN=vTmixN, full_sel=False, | ||
comptable, _, _, _ = model.dependence_metrics( | ||
data_cat, data_oc, comp_ts, eimum, t2s, tes, ref_img, | ||
reindex=False, mmixN=vTmixN, method=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
method
is a little too ambiguous of an argument, here.
tedana/model/fit.py
Outdated
Whether to sort components in descending order by Kappa. Default: False | ||
mmixN : (T x C) array_like, optional | ||
Z-scored mixing matrix. Default: None | ||
method : {'kundu_v2', 'kundu_v3', None}, optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could call this decision
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does None
make sense as the default argument ? What behavior do we expect when we return an empty seldict
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also still really unsure that we should have kundu_v3
here, since it's not reintegrated, and we don't know when it will be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None
is the PCA decision tree-compatible version, which doesn't return metric maps and only gives back the component table. I could change that to pca
or kundu_pca
?
kundu_v3
requires certain metric maps in seldict
(e.g., PSC
, WTS
, and tsoc_B
) that kundu_v2
does not. I didn't want to remove those metric maps from the overall function, because it would be annoying to re-implement them later, but also didn't want to output an oversized version of seldict
when it's not necessary. I can drop it from the arguments and docstring, but I'd like to keep it in the if/else statement below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think decision
is right, since that implies that actual decisions are made in this function. It really just determines which outputs will be generated. PCA requires just the component table, while Kundu ICA v2 requires that and several metric maps, and Kundu ICA v3 requires the component table and even more metric maps.
What about algorithm
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to vote for algorithm
; it's wide open for adding other, well, algorithms.
from tedana.model import fit | ||
|
||
|
||
def test_break_dependence_metrics(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍
Co-Authored-By: tsalo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is altogether fantastic work. I've left some comments indicating where I think some documentation could be shored up, but I don't think it's anything major. Thanks @tsalo !
tedana/model/fit.py
Outdated
Whether to sort components in descending order by Kappa. Default: False | ||
mmixN : (T x C) array_like, optional | ||
Z-scored mixing matrix. Default: None | ||
method : {'kundu_v2', 'kundu_v3', None}, optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to vote for algorithm
; it's wide open for adding other, well, algorithms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With your latest commit everything looks good. Awesome, thanks @tsalo !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't believe I missed that in my review; oopsie.
@jbteves Thanks! Would you mind changing your review status? |
@tsalo done! Awesome. |
Yay, merging now. |
Closes #16. This was originally part of #247, but has been split off because it is self-contained and should be merged separately.
Changes proposed in this pull request: