I’d like to apply this example: Nilearn: Statistical Analysis for NeuroImaging in Python — Machine learning for NeuroImaging
to a Neurovault image. I get this error when I try to apply GraphicalLassoCV.
data = datasets.fetch_neurovault_ids(image_ids=[34])
img = data.images
from nilearn import datasets
atlas = datasets.fetch_atlas_msdl()
# Loading atlas image stored in 'maps'
atlas_filename = atlas['maps']
# Loading atlas data stored in 'labels'
labels = atlas['labels']
from nilearn.input_data import NiftiMapsMasker
masker = NiftiMapsMasker(maps_img=atlas_filename, standardize=True,
memory='nilearn_cache', verbose=5)
time_series = masker.fit_transform(img)
try:
from sklearn.covariance import GraphicalLassoCV
except ImportError:
# for Scitkit-Learn < v0.20.0
from sklearn.covariance import GraphLassoCV as GraphicalLassoCV
estimator = GraphicalLassoCV()
estimator.fit(time_series)
In case the issue was with the Neurovault file, I tried using spm_auditory by making these changed:
data = datasets.fetch_spm_auditory(subject_id='sub003')
img = data.func1[0]
but got the same error.