8.3.2. SpaceNet on Jimura et al “mixed gambles” dataset.ΒΆ

The segmenting power of SpaceNet is quite visible here.

See also the SpaceNet documentation: SpaceNet: decoding with spatial structure for better maps.

# author: DOHMATOB Elvis Dopgima,
#         GRAMFORT Alexandre

Load the data from the Jimura mixed-gamble experiment

from nilearn.datasets import fetch_mixed_gambles
data = fetch_mixed_gambles(n_subjects=16)

zmap_filenames = data.zmaps
behavioral_target = data.gain
mask_filename = data.mask_img

Fit TV-L1 Here we’re using the regressor object given that the task is to predict a continuous variable, the gain of the gamble.

from nilearn.decoding import SpaceNetRegressor
decoder = SpaceNetRegressor(mask=mask_filename, penalty="tv-l1",
                            eps=1e-1,  # prefer large alphas
                            memory="nilearn_cache")

decoder.fit(zmap_filenames, behavioral_target)

# Visualize TV-L1 weights
from nilearn.plotting import plot_stat_map, show
plot_stat_map(decoder.coef_img_, title="tv-l1", display_mode="yz",
              cut_coords=[20, -2])
../../_images/sphx_glr_plot_mixed_gambles_space_net_001.png

Out:

[NiftiMasker.fit] Loading data from None
[NiftiMasker.fit] Resampling mask
Time Elapsed: 488.734 seconds, 8 minutes.

Fit Graph-Net

decoder = SpaceNetRegressor(mask=mask_filename, penalty="graph-net",
                            eps=1e-1,  # prefer large alphas
                            memory="nilearn_cache")
decoder.fit(zmap_filenames, behavioral_target)

# Visualize Graph-Net weights
plot_stat_map(decoder.coef_img_, title="graph-net", display_mode="yz",
              cut_coords=[20, -2])

show()
../../_images/sphx_glr_plot_mixed_gambles_space_net_002.png

Out:

[NiftiMasker.fit] Loading data from None
[NiftiMasker.fit] Resampling mask
Time Elapsed: 110.903 seconds, 1 minutes.

Total running time of the script: ( 10 minutes 2.702 seconds)

Generated by Sphinx-Gallery