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

[MRG] Iter age group prediction example #2063

Merged

Conversation

jeromedockes
Copy link
Member

@jeromedockes jeromedockes commented May 17, 2019

  • warn about small sample size
  • simplify cross-val code with gridsearch
  • include tangent space fitting in the cross-validated pipeline
  • show cross-val score standard deviation on the bar plot

@codecov
Copy link

codecov bot commented May 18, 2019

Codecov Report

Merging #2063 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2063   +/-   ##
=======================================
  Coverage   94.98%   94.98%           
=======================================
  Files         141      141           
  Lines       18298    18298           
=======================================
  Hits        17380    17380           
  Misses        918      918

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 2dde3f9...bf66048. Read the comment docs.

@codecov
Copy link

codecov bot commented May 18, 2019

Codecov Report

Merging #2063 into master will increase coverage by 0.16%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2063      +/-   ##
==========================================
+ Coverage   92.21%   92.38%   +0.16%     
==========================================
  Files         149      149              
  Lines       18752    18761       +9     
  Branches     2277     2279       +2     
==========================================
+ Hits        17293    17333      +40     
+ Misses        944      917      -27     
+ Partials      515      511       -4
Impacted Files Coverage Δ
nilearn/tests/test_signal.py 99.23% <0%> (-0.77%) ⬇️
nilearn/plotting/tests/test_surf_plotting.py 100% <0%> (ø) ⬆️
nilearn/plotting/img_plotting.py 88.19% <0%> (ø) ⬆️
nilearn/_utils/testing.py 78.76% <0%> (ø) ⬆️
nilearn/plotting/surf_plotting.py 76.25% <0%> (+0.52%) ⬆️
nilearn/image/resampling.py 93.75% <0%> (+0.89%) ⬆️
nilearn/image/tests/test_image.py 99.45% <0%> (+1.09%) ⬆️
nilearn/regions/parcellations.py 96.19% <0%> (+1.9%) ⬆️
nilearn/_utils/cache_mixin.py 83.65% <0%> (+1.92%) ⬆️
nilearn/decoding/fista.py 90.12% <0%> (+2.46%) ⬆️
... and 4 more

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 e0ae31c...3f59840. Read the comment docs.

@jeromedockes
Copy link
Member Author

failure is related to #2056 and not this PR.

@jeromedockes
Copy link
Member Author

ping @GaelVaroquaux or @KamalakerDadi for a review

@jeromedockes
Copy link
Member Author

@emdupre
Copy link
Member

emdupre commented Oct 2, 2019

Is this blocked by #2035 ?

@jeromedockes
Copy link
Member Author

jeromedockes commented Oct 3, 2019 via email

@emdupre
Copy link
Member

emdupre commented Oct 3, 2019

I can review if that's helpful ? Though I don't think it counts towards an official "approval."

@GaelVaroquaux
Copy link
Member

GaelVaroquaux commented Oct 3, 2019 via email

Copy link
Member

@emdupre emdupre left a comment

Choose a reason for hiding this comment

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

I think this is a big improvement, thanks @jeromedockes ! Small questions and comments.

examples/03_connectivity/plot_group_level_connectivity.py Outdated Show resolved Hide resolved
@@ -57,7 +39,7 @@ def plot_matrices(matrices, matrix_kind):

masker = input_data.NiftiMapsMasker(
msdl_data.maps, resampling_target="data", t_r=2, detrend=True,
low_pass=.1, high_pass=.01, memory='nilearn_cache', memory_level=1)
low_pass=.1, high_pass=.01, memory='nilearn_cache', memory_level=1).fit([])
Copy link
Member

Choose a reason for hiding this comment

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

What's the reasoning for adding the .fit() here distinct from .fit_transform() as previously ? It feels less explicit, as a reader.

Copy link
Member Author

Choose a reason for hiding this comment

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

because the masker is not fitted on the data provided to transform (or fit_transform)

examples/03_connectivity/plot_group_level_connectivity.py Outdated Show resolved Hide resolved
###############################################################################
# Finally, we can display the classification scores.
from nilearn.plotting import show
print(kind)
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure what this print statement adds, other than having an output between the cells. Slight stylistic preference to drop -- feel free to ignore.

# We study only 60 subjects from the dataset, to save computation time.
from nilearn import datasets

rest_data = datasets.fetch_development_fmri(n_subjects=60)
Copy link
Member

Choose a reason for hiding this comment

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

rest_data might be misleading, here, since they're watching a movie. Maybe just func_data ?


masker = NiftiMapsMasker(
msdl_data.maps, resampling_target="data", t_r=2, detrend=True,
low_pass=.1, high_pass=.01, memory='nilearn_cache', memory_level=1).fit([])
Copy link
Member

Choose a reason for hiding this comment

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

Same question as above on empty .fit as opposed to .fit_transform

examples/03_connectivity/plot_group_level_connectivity.py Outdated Show resolved Hide resolved
jeromedockes and others added 2 commits October 4, 2019 10:38
Co-Authored-By: Elizabeth DuPre <emd222@cornell.edu>
Co-Authored-By: bthirion <bertrand.thirion@inria.fr>
@kchawla-pi
Copy link
Collaborator

Pulling from master should resolve the CircleCI failure

@jeromedockes
Copy link
Member Author

jeromedockes commented Oct 4, 2019 via email

@kchawla-pi
Copy link
Collaborator

I am assuming no more comments. I will merge this PR on Wednesday.

Copy link
Contributor

@KamalakerDadi KamalakerDadi left a comment

Choose a reason for hiding this comment

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

I don't have strong opinion on the advanced example. I would like to convert this advanced example into teaching material by adding them into user guide in the functional connectivity slot. AFAIK there is no guide showing supervised learning based on functional connectomes.

@@ -1,43 +1,25 @@
"""
Functional connectivity matrices for group analysis of connectomes
==================================================================
Functional connectivity predicts age group
Copy link
Contributor

Choose a reason for hiding this comment

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

I would write "Functional connectome-based classification of age groups". You can write predict but I am more used to listen this on a continuous range scale.

development_dataset.func,
development_dataset.confounds,
development_dataset.phenotypic):
time_series = masker.transform(func_file, confounds=confound_file)
Copy link
Contributor

Choose a reason for hiding this comment

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

Using fit_transform is straight-forward. I feel.

@jeromedockes jeromedockes changed the title Iter age group prediction example [MRG] Iter age group prediction example Oct 8, 2019
@kchawla-pi
Copy link
Collaborator

kchawla-pi commented Oct 8, 2019

Will merge once the current crop of CircleCI master builds have completed.

@kchawla-pi
Copy link
Collaborator

This needs a whats_new entry.

@kchawla-pi kchawla-pi merged commit eedc39e into nilearn:master Oct 8, 2019
kchawla-pi added a commit to KamalakerDadi/nilearn that referenced this pull request Oct 9, 2019
…s_brain_orientation

* 'master' of https://github.com/nilearn/nilearn: (116 commits)
  Import HTMLDocument in its original module to preserve backwards compatibility (nilearn#2162)
  Fixing malfunctioning allowed-failure section in Travis (nilearn#2160)
  Update Brainomics fetcher (nilearn#2097)
  Remove inplace modification in signal.clean (nilearn#2125)
  Iter age group prediction example (nilearn#2063)
  Expose bg_img, vmin and vmax in plot_img signature (nilearn#2157)
  Replac conda with pip in TravisCI setup (nilearn#2141)
  Core devs doc and add @emdupre (nilearn#2151)
  Add check for vmin, vmax in plot_surf_roi (nilearn#2052)
  [ENH] Initial visual reports (nilearn#2019)
  Renamed test to deduplicate name (nilearn#2144)
  Fixes nilearn#2029 Handle gzip files without extensions (nilearn#2126)
  Update Schaefer parcelation to v0.14.3 (nilearn#2138)
  MAINT: Future-compatible cmap reversal (nilearn#2131)
  fix openmp crash (nilearn#2140)
  change nose to pytest on appveyor (nilearn#2130)
  adding fix to whatsnew
  fix wrong urls in nki dataset
  Made Flake8 happy
  added whats_new
  ...

# Conflicts:
#	doc/whats_new.rst
kchawla-pi added a commit to glemaitre/nilearn that referenced this pull request Oct 9, 2019
…lot_connectome_strength

* 'master' of https://github.com/nilearn/nilearn: (272 commits)
  [MRG] FIX: orientation problem with plot_glass_brain (nilearn#1888)
  Import HTMLDocument in its original module to preserve backwards compatibility (nilearn#2162)
  Fixing malfunctioning allowed-failure section in Travis (nilearn#2160)
  Update Brainomics fetcher (nilearn#2097)
  Remove inplace modification in signal.clean (nilearn#2125)
  Iter age group prediction example (nilearn#2063)
  Expose bg_img, vmin and vmax in plot_img signature (nilearn#2157)
  Replac conda with pip in TravisCI setup (nilearn#2141)
  Core devs doc and add @emdupre (nilearn#2151)
  Add check for vmin, vmax in plot_surf_roi (nilearn#2052)
  [ENH] Initial visual reports (nilearn#2019)
  Renamed test to deduplicate name (nilearn#2144)
  Fixes nilearn#2029 Handle gzip files without extensions (nilearn#2126)
  Update Schaefer parcelation to v0.14.3 (nilearn#2138)
  MAINT: Future-compatible cmap reversal (nilearn#2131)
  fix openmp crash (nilearn#2140)
  change nose to pytest on appveyor (nilearn#2130)
  adding fix to whatsnew
  fix wrong urls in nki dataset
  Made Flake8 happy
  ...

# Conflicts:
#	examples/03_connectivity/plot_sphere_based_connectome.py
kchawla-pi added a commit to KamalakerDadi/nilearn that referenced this pull request Oct 9, 2019
…ounds_for_connectome

* 'master' of https://github.com/nilearn/nilearn: (227 commits)
  [MRG] FIX: orientation problem with plot_glass_brain (nilearn#1888)
  Import HTMLDocument in its original module to preserve backwards compatibility (nilearn#2162)
  Fixing malfunctioning allowed-failure section in Travis (nilearn#2160)
  Update Brainomics fetcher (nilearn#2097)
  Remove inplace modification in signal.clean (nilearn#2125)
  Iter age group prediction example (nilearn#2063)
  Expose bg_img, vmin and vmax in plot_img signature (nilearn#2157)
  Replac conda with pip in TravisCI setup (nilearn#2141)
  Core devs doc and add @emdupre (nilearn#2151)
  Add check for vmin, vmax in plot_surf_roi (nilearn#2052)
  [ENH] Initial visual reports (nilearn#2019)
  Renamed test to deduplicate name (nilearn#2144)
  Fixes nilearn#2029 Handle gzip files without extensions (nilearn#2126)
  Update Schaefer parcelation to v0.14.3 (nilearn#2138)
  MAINT: Future-compatible cmap reversal (nilearn#2131)
  fix openmp crash (nilearn#2140)
  change nose to pytest on appveyor (nilearn#2130)
  adding fix to whatsnew
  fix wrong urls in nki dataset
  Made Flake8 happy
  ...
kchawla-pi added a commit to KamalakerDadi/nilearn that referenced this pull request Oct 9, 2019
…_roi_contours

* 'master' of https://github.com/nilearn/nilearn: (227 commits)
  [MRG] FIX: orientation problem with plot_glass_brain (nilearn#1888)
  Import HTMLDocument in its original module to preserve backwards compatibility (nilearn#2162)
  Fixing malfunctioning allowed-failure section in Travis (nilearn#2160)
  Update Brainomics fetcher (nilearn#2097)
  Remove inplace modification in signal.clean (nilearn#2125)
  Iter age group prediction example (nilearn#2063)
  Expose bg_img, vmin and vmax in plot_img signature (nilearn#2157)
  Replac conda with pip in TravisCI setup (nilearn#2141)
  Core devs doc and add @emdupre (nilearn#2151)
  Add check for vmin, vmax in plot_surf_roi (nilearn#2052)
  [ENH] Initial visual reports (nilearn#2019)
  Renamed test to deduplicate name (nilearn#2144)
  Fixes nilearn#2029 Handle gzip files without extensions (nilearn#2126)
  Update Schaefer parcelation to v0.14.3 (nilearn#2138)
  MAINT: Future-compatible cmap reversal (nilearn#2131)
  fix openmp crash (nilearn#2140)
  change nose to pytest on appveyor (nilearn#2130)
  adding fix to whatsnew
  fix wrong urls in nki dataset
  Made Flake8 happy
  ...
kchawla-pi added a commit to illdopejake/nilearn that referenced this pull request Oct 12, 2019
…nt_modify_fetch_dev

* 'master' of https://github.com/nilearn/nilearn: (228 commits)
  [MRG] Nans in view connectome (nilearn#2166)
  [MRG] FIX: orientation problem with plot_glass_brain (nilearn#1888)
  Import HTMLDocument in its original module to preserve backwards compatibility (nilearn#2162)
  Fixing malfunctioning allowed-failure section in Travis (nilearn#2160)
  Update Brainomics fetcher (nilearn#2097)
  Remove inplace modification in signal.clean (nilearn#2125)
  Iter age group prediction example (nilearn#2063)
  Expose bg_img, vmin and vmax in plot_img signature (nilearn#2157)
  Replac conda with pip in TravisCI setup (nilearn#2141)
  Core devs doc and add @emdupre (nilearn#2151)
  Add check for vmin, vmax in plot_surf_roi (nilearn#2052)
  [ENH] Initial visual reports (nilearn#2019)
  Renamed test to deduplicate name (nilearn#2144)
  Fixes nilearn#2029 Handle gzip files without extensions (nilearn#2126)
  Update Schaefer parcelation to v0.14.3 (nilearn#2138)
  MAINT: Future-compatible cmap reversal (nilearn#2131)
  fix openmp crash (nilearn#2140)
  change nose to pytest on appveyor (nilearn#2130)
  adding fix to whatsnew
  fix wrong urls in nki dataset
  ...

# Conflicts:
#	nilearn/datasets/func.py
kchawla-pi added a commit to KamalakerDadi/nilearn that referenced this pull request Oct 14, 2019
…ecomposition

* 'master' of https://github.com/nilearn/nilearn: (348 commits)
  [MRG] FIX: orientation problem with plot_glass_brain (nilearn#1888)
  Import HTMLDocument in its original module to preserve backwards compatibility (nilearn#2162)
  Fixing malfunctioning allowed-failure section in Travis (nilearn#2160)
  Update Brainomics fetcher (nilearn#2097)
  Remove inplace modification in signal.clean (nilearn#2125)
  Iter age group prediction example (nilearn#2063)
  Expose bg_img, vmin and vmax in plot_img signature (nilearn#2157)
  Replac conda with pip in TravisCI setup (nilearn#2141)
  Core devs doc and add @emdupre (nilearn#2151)
  Add check for vmin, vmax in plot_surf_roi (nilearn#2052)
  [ENH] Initial visual reports (nilearn#2019)
  Renamed test to deduplicate name (nilearn#2144)
  Fixes nilearn#2029 Handle gzip files without extensions (nilearn#2126)
  Update Schaefer parcelation to v0.14.3 (nilearn#2138)
  MAINT: Future-compatible cmap reversal (nilearn#2131)
  fix openmp crash (nilearn#2140)
  change nose to pytest on appveyor (nilearn#2130)
  adding fix to whatsnew
  fix wrong urls in nki dataset
  Made Flake8 happy
  ...

# Conflicts:
#	doc/connectivity/resting_state_networks.rst
#	doc/whats_new.rst
#	examples/03_connectivity/plot_canica_analysis.py
kchawla-pi added a commit to pausz/nilearn that referenced this pull request Oct 18, 2019
…smooth-image

* 'master' of https://github.com/nilearn/nilearn: (114 commits)
  [DOC] Update whats_new to reference nilearn#2013 (Merging of several examples) (nilearn#2183)
  Removed sub-example due to unfit for lasso dataset - unstable float values (nilearn#2177)
  Fix Flake8 errors overlooked when merging PR nilearn#2028 (Plot connectome strength) (nilearn#2174)
  ENH: add connectome strength plot (nilearn#2028)
  Fix cache mixin tests (nilearn#2161)
  Do not fail if metadata cannot be updated for an image (nilearn#2167)
  [MRG] Nans in view connectome (nilearn#2166)
  [MRG] FIX: orientation problem with plot_glass_brain (nilearn#1888)
  Import HTMLDocument in its original module to preserve backwards compatibility (nilearn#2162)
  Fixing malfunctioning allowed-failure section in Travis (nilearn#2160)
  Update Brainomics fetcher (nilearn#2097)
  Remove inplace modification in signal.clean (nilearn#2125)
  Iter age group prediction example (nilearn#2063)
  Expose bg_img, vmin and vmax in plot_img signature (nilearn#2157)
  Replac conda with pip in TravisCI setup (nilearn#2141)
  Core devs doc and add @emdupre (nilearn#2151)
  Add check for vmin, vmax in plot_surf_roi (nilearn#2052)
  [ENH] Initial visual reports (nilearn#2019)
  Renamed test to deduplicate name (nilearn#2144)
  Fixes nilearn#2029 Handle gzip files without extensions (nilearn#2126)
  ...
kchawla-pi added a commit to kchawla-pi/nilearn that referenced this pull request Oct 24, 2019
…te-req-dev

* 'master' of https://github.com/nilearn/nilearn: (336 commits)
  Release Nilearn 0.6.0 alpha (nilearn#2164)
  Making fetch_localizer_button_task backwards compatibile (nilearn#2182)
  [DOC] Update whats_new to reference nilearn#2013 (Merging of several examples) (nilearn#2183)
  Removed sub-example due to unfit for lasso dataset - unstable float values (nilearn#2177)
  Fix Flake8 errors overlooked when merging PR nilearn#2028 (Plot connectome strength) (nilearn#2174)
  ENH: add connectome strength plot (nilearn#2028)
  Fix cache mixin tests (nilearn#2161)
  Do not fail if metadata cannot be updated for an image (nilearn#2167)
  [MRG] Nans in view connectome (nilearn#2166)
  [MRG] FIX: orientation problem with plot_glass_brain (nilearn#1888)
  Import HTMLDocument in its original module to preserve backwards compatibility (nilearn#2162)
  Fixing malfunctioning allowed-failure section in Travis (nilearn#2160)
  Update Brainomics fetcher (nilearn#2097)
  Remove inplace modification in signal.clean (nilearn#2125)
  Iter age group prediction example (nilearn#2063)
  Expose bg_img, vmin and vmax in plot_img signature (nilearn#2157)
  Replac conda with pip in TravisCI setup (nilearn#2141)
  Core devs doc and add @emdupre (nilearn#2151)
  Add check for vmin, vmax in plot_surf_roi (nilearn#2052)
  [ENH] Initial visual reports (nilearn#2019)
  ...
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.

None yet

6 participants