#导入库函数
from nilearn import datasets
from nilearn.decomposition import DictLearning
from nilearn import plotting
#下载数据集
rest_dataset = datasets.fetch_development_fmri(n_subjects = 20)
# 构建字典分解的实例
dict_learn = DictLearning(n_components=8,smoothing_fwhm=6.,
memory="nilearn_cache",memory_level=2,
random_state=0)
dict_learn.fit(rest_dataset["func"])
# 可视化字典分解的结果
plotting.plot_prob_atlas(dict_learn.components_img_,view_type="filled_contours",
title="Dictionary Learning maps")