-
Notifications
You must be signed in to change notification settings - Fork 58
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
Support liberal mask in IBMA estimators #848
Conversation
That's so awesome! Do you have a DOF map among the outputs? |
We don't have them now, but that will be a great addition. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #848 +/- ##
==========================================
- Coverage 89.13% 89.10% -0.03%
==========================================
Files 49 49
Lines 6155 6417 +262
==========================================
+ Hits 5486 5718 +232
- Misses 669 699 +30 ☔ View full report in Codecov by Sentry. |
Thanks @tsalo! Would that look like the figure below? |
I can't access the linked figure, unfortunately. |
Sorry, I edited the message yesterday, so the figure probably got deleted. |
I can see it now. It looks awesome! |
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.
just a couple changes I requested, but otherwise LGTM, will think of possible refactor of some of the class specific bag handling to be placed in the base class.
nimare/meta/utils.py
Outdated
# This is the same for all voxels in the match | ||
study_mask = study_by_voxels_idxs[voxel_mask[0]] | ||
|
||
if len(study_mask) < 2: |
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.
set the number 2 to a variable here, like MIN_STUDY_THRESH
, defined at the top of the function.
nimare/tests/test_meta_ibma.py
Outdated
pytest.param( | ||
ibma.Stouffers, | ||
False, | ||
{"use_sample_size": True}, | ||
None, | ||
{}, | ||
("z", "p", "dof"), | ||
id="Stouffers_weighted", | ||
), | ||
pytest.param( | ||
ibma.WeightedLeastSquares, | ||
True, | ||
{"tau2": 0}, | ||
None, | ||
{}, | ||
("z", "p", "est", "se", "dof"), | ||
id="WeightedLeastSquares", | ||
), | ||
pytest.param( | ||
ibma.WeightedLeastSquares, | ||
False, | ||
{"tau2": 0}, | ||
None, | ||
{}, | ||
("z", "p", "est", "se"), | ||
("z", "p", "est", "se", "dof"), | ||
id="WeightedLeastSquares", | ||
), | ||
pytest.param( | ||
ibma.DerSimonianLaird, | ||
True, | ||
{}, | ||
None, | ||
{}, | ||
("z", "p", "est", "se", "tau2"), | ||
("z", "p", "est", "se", "tau2", "dof"), | ||
id="DerSimonianLaird", | ||
), | ||
pytest.param( | ||
ibma.DerSimonianLaird, | ||
False, | ||
{}, | ||
None, | ||
{}, | ||
("z", "p", "est", "se", "tau2", "dof"), | ||
id="DerSimonianLaird", | ||
), | ||
pytest.param( | ||
ibma.Hedges, | ||
True, | ||
{}, | ||
None, | ||
{}, | ||
("z", "p", "est", "se", "tau2"), | ||
("z", "p", "est", "se", "tau2", "dof"), | ||
id="Hedges", | ||
), | ||
pytest.param( | ||
ibma.Hedges, | ||
False, | ||
{}, | ||
None, | ||
{}, | ||
("z", "p", "est", "se", "tau2", "dof"), | ||
id="Hedges", | ||
), | ||
pytest.param( | ||
ibma.SampleSizeBasedLikelihood, | ||
True, | ||
{"method": "ml"}, | ||
None, | ||
{}, | ||
("z", "p", "est", "se", "tau2", "sigma2", "dof"), | ||
id="SampleSizeBasedLikelihood_ml", | ||
), | ||
pytest.param( | ||
ibma.SampleSizeBasedLikelihood, | ||
False, | ||
{"method": "ml"}, | ||
None, | ||
{}, | ||
("z", "p", "est", "se", "tau2", "sigma2"), | ||
("z", "p", "est", "se", "tau2", "sigma2", "dof"), | ||
id="SampleSizeBasedLikelihood_ml", | ||
), | ||
pytest.param( | ||
ibma.SampleSizeBasedLikelihood, | ||
True, | ||
{"method": "reml"}, | ||
None, | ||
{}, | ||
("z", "p", "est", "se", "tau2", "sigma2"), | ||
("z", "p", "est", "se", "tau2", "sigma2", "dof"), | ||
id="SampleSizeBasedLikelihood_reml", | ||
), | ||
pytest.param( | ||
ibma.SampleSizeBasedLikelihood, | ||
False, | ||
{"method": "reml"}, | ||
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.
I couldn't select all the lines I needed to, but this can be simplified since aggressive_masking is being turned on/off for every IBMA, you can specify another parametrize decorator (see at the bottom, and the ids just name the tests more clearly).
@pytest.mark.parametrize(
"meta,meta_kwargs,corrector,corrector_kwargs,maps",
[
pytest.param(
ibma.Fishers,
{},
FDRCorrector,
{"method": "indep", "alpha": 0.001},
("z", "p", "dof"),
id="Fishers",
),
pytest.param(
ibma.Stouffers,
{"use_sample_size": False},
None,
{},
("z", "p", "dof"),
id="Stouffers",
),
pytest.param(
ibma.Stouffers,
{"use_sample_size": True},
None,
{},
("z", "p", "dof"),
id="Stouffers_weighted",
),
pytest.param(
ibma.WeightedLeastSquares,
{"tau2": 0},
None,
{},
("z", "p", "est", "se", "dof"),
id="WeightedLeastSquares",
),
pytest.param(
ibma.DerSimonianLaird,
{},
None,
{},
("z", "p", "est", "se", "tau2", "dof"),
id="DerSimonianLaird",
),
pytest.param(
ibma.Hedges,
{},
None,
{},
("z", "p", "est", "se", "tau2", "dof"),
id="Hedges",
),
pytest.param(
ibma.SampleSizeBasedLikelihood,
{"method": "ml"},
None,
{},
("z", "p", "est", "se", "tau2", "sigma2", "dof"),
id="SampleSizeBasedLikelihood_ml",
),
pytest.param(
ibma.SampleSizeBasedLikelihood,
{"method": "reml"},
None,
{},
("z", "p", "est", "se", "tau2", "sigma2", "dof"),
id="SampleSizeBasedLikelihood_reml",
),
pytest.param(
ibma.VarianceBasedLikelihood,
{"method": "ml"},
None,
{},
("z", "p", "est", "se", "tau2", "dof"),
id="VarianceBasedLikelihood_ml",
),
pytest.param(
ibma.VarianceBasedLikelihood,
{"method": "reml"},
None,
{},
("z", "p", "est", "se", "tau2", "dof"),
id="VarianceBasedLikelihood_reml",
),
pytest.param(
ibma.PermutedOLS,
{"two_sided": True},
FWECorrector,
{"method": "montecarlo", "n_iters": 100, "n_cores": 1},
("t", "z", "dof"),
id="PermutedOLS",
),
],
)
@pytest.mark.parametrize("aggressive_mask", [True, False], ids=["aggressive", "liberal"])
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.
There is some potential repetitive code, but that can be refactored later, LGTM!
Closes None. Related to neurostuff/PyMARE#44
Changes proposed in this pull request: