本文整理汇总了Python中sklearn.datasets.base.Bunch.zmaps方法的典型用法代码示例。如果您正苦于以下问题:Python Bunch.zmaps方法的具体用法?Python Bunch.zmaps怎么用?Python Bunch.zmaps使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.datasets.base.Bunch
的用法示例。
在下文中一共展示了Bunch.zmaps方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fetch_mixed_gambles
# 需要导入模块: from sklearn.datasets.base import Bunch [as 别名]
# 或者: from sklearn.datasets.base.Bunch import zmaps [as 别名]
def fetch_mixed_gambles(n_subjects=1, data_dir=None, url=None, resume=True, return_raw_data=False, verbose=0):
"""Fetch Jimura "mixed gambles" dataset.
Parameters
----------
n_subjects: int, optional (default 1)
The number of subjects to load. If None is given, all the
subjects are used.
data_dir: string, optional (default None)
Path of the data directory. Used to force data storage in a specified
location. Default: None.
url: string, optional (default None)
Override download URL. Used for test only (or if you setup a mirror of
the data).
resume: bool, optional (default True)
If true, try resuming download if possible.
verbose: int, optional (default 0)
Defines the level of verbosity of the output.
return_raw_data: bool, optional (default True)
If false, then the data will transformed into and (X, y) pair, suitable
for machine learning routines. X is a list of n_subjects * 48
Nifti1Image objects (where 48 is the number of trials),
and y is an array of shape (n_subjects * 48,).
smooth: float, or list of 3 floats, optional (default 0.)
Size of smoothing kernel to apply to the loaded zmaps.
Returns
-------
data: Bunch
Dictionary-like object, the interest attributes are :
'zmaps': string list
Paths to realigned gain betamaps (one nifti per subject).
'gain': ..
If make_Xy is true, this is a list of n_subjects * 48
Nifti1Image objects, else it is None.
'y': array of shape (n_subjects * 48,) or None
If make_Xy is true, then this is an array of shape
(n_subjects * 48,), else it is None.
References
----------
[1] K. Jimura and R. Poldrack, "Analyses of regional-average activation
and multivoxel pattern information tell complementary stories",
Neuropsychologia, vol. 50, page 544, 2012
"""
if n_subjects > 16:
warnings.warn("Warning: there are only 16 subjects!")
n_subjects = 16
if url is None:
url = "https://www.nitrc.org/frs/download.php/7229/" "jimura_poldrack_2012_zmaps.zip"
opts = dict(uncompress=True)
files = [("zmaps%ssub%03i_zmaps.nii.gz" % (os.sep, (j + 1)), url, opts) for j in range(n_subjects)]
data_dir = _get_dataset_dir("jimura_poldrack_2012_zmaps", data_dir=data_dir)
zmap_fnames = _fetch_files(data_dir, files, resume=resume, verbose=verbose)
data = Bunch(zmaps=zmap_fnames)
if not return_raw_data:
X, y, mask_img = _load_mixed_gambles(map(nibabel.load, data.zmaps))
data.zmaps, data.gain, data.mask_img = X, y, mask_img
return data