本文整理汇总了Python中mvpa2.measures.base.Measure类的典型用法代码示例。如果您正苦于以下问题:Python Measure类的具体用法?Python Measure怎么用?Python Measure使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Measure类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, axis, fx, other_axis_prefix=None, **kwargs):
'''
Parameters
----------
axis: str or int
'samples' (or 0) or 'features' (or 1).
fx: callable
function to determine the winner. When called with a dataset ds,
it should return a vector with ds.nsamples values
(if axis=='features') or ds.nfeatures values (if axis=='samples').
other_axis_prefix: str
prefix used for feature or sample attributes set on the other axis.
'''
Measure.__init__(self, **kwargs)
if type(axis) is str:
str2num = dict(samples=0, features=1)
if not axis in str2num:
raise ValueError("Illegal axis: should be %s" %
' or '.join(str2num))
axis = str2num[axis]
elif not axis in (0, 1):
raise ValueError("Illegal axis: should be 0 or 1")
self.__axis = axis
self.__fx = fx
self.__other_axis_prefix = other_axis_prefix
开发者ID:neurosbh,项目名称:PyMVPA,代码行数:27,代码来源:winner.py
示例2: __init__
def __init__(self, queryengine, roi_ids=None, nproc=None, **kwargs):
"""
Parameters
----------
queryengine : QueryEngine
Engine to use to discover the "neighborhood" of each feature.
See :class:`~mvpa2.misc.neighborhood.QueryEngine`.
roi_ids : None or list(int) or str
List of feature ids (not coordinates) the shall serve as ROI seeds
(e.g. sphere centers). Alternatively, this can be the name of a
feature attribute of the input dataset, whose non-zero values
determine the feature ids. By default all features will be used.
nproc : None or int
How many processes to use for computation. Requires `pprocess`
external module. If None -- all available cores will be used.
**kwargs
In addition this class supports all keyword arguments of its
base-class :class:`~mvpa2.measures.base.Measure`.
"""
Measure.__init__(self, **kwargs)
if nproc is not None and nproc > 1 and not externals.exists('pprocess'):
raise RuntimeError("The 'pprocess' module is required for "
"multiprocess searchlights. Please either "
"install python-pprocess, or reduce `nproc` "
"to 1 (got nproc=%i)" % nproc)
self._queryengine = queryengine
if roi_ids is not None and not isinstance(roi_ids, str) \
and not len(roi_ids):
raise ValueError, \
"Cannot run searchlight on an empty list of roi_ids"
self.__roi_ids = roi_ids
self.nproc = nproc
开发者ID:otizonaizit,项目名称:PyMVPA,代码行数:34,代码来源:searchlight.py
示例3: __init__
def __init__(self, pairwise_metric='correlation', center_data=False,
square=False, **kwargs):
"""Initialize
Parameters
----------
pairwise_metric : String. Distance metric to use for calculating
pairwise vector distances for dissimilarity matrix
(DSM). See scipy.spatial.distance.pdist for all
possible metrics. (Default ='correlation', i.e. one
minus Pearson correlation)
center_data : boolean. (Optional. Default = False) If True then center
each column of the data matrix by subtracing the column
mean from each element (by chunk if chunks_attr
specified). This is recommended especially when using
pairwise_metric = 'correlation'.
square : boolean. (Optional. Default = False) If True return
the square distance matrices, if False, returns the
flattened lower triangle.
Returns
-------
Dataset : Contains a column vector of length = n(n-1)/2 of pairwise
distances between all samples if square = False; square
dissimilarty matrix if square = True.
"""
Measure.__init__(self, **kwargs)
self.pairwise_metric = pairwise_metric
self.center_data = center_data
self.square = square
开发者ID:rystoli,项目名称:RyMVPA,代码行数:32,代码来源:rsa.py
示例4: __init__
def __init__(self, dsmatrix, dset_metric, output_metric="spearman"):
Measure.__init__(self)
self.dsmatrix = dsmatrix
self.dset_metric = dset_metric
self.output_metric = output_metric
self.dset_dsm = []
开发者ID:kirtyvedula,项目名称:PyMVPA,代码行数:7,代码来源:ds.py
示例5: __init__
def __init__(self, dset_metric, nsubjs, compare_ave, k, **kwargs):
Measure.__init__(self, **kwargs)
self.dset_metric = dset_metric
self.dset_dsm = []
self.nsubjs = nsubjs
self.compare_ave = compare_ave
self.k = k
开发者ID:PepGardiola,项目名称:PyMVPA,代码行数:8,代码来源:rsm.py
示例6: __init__
def __init__(self, **kwargs):
"""
Returns
-------
Dataset
If square is False, contains a column vector of length = n(n-1)/2 of
pairwise distances between all samples. A sample attribute ``pairs``
identifies the indices of input samples for each individual pair.
If square is True, the dataset contains a square dissimilarty matrix
and the entire sample attributes collection of the input dataset.
"""
Measure.__init__(self, **kwargs)
开发者ID:Arthurkorn,项目名称:PyMVPA,代码行数:13,代码来源:rsa.py
示例7: __init__
def __init__(self, target_dsm, partial_dsm = None, pairwise_metric='correlation',
comparison_metric='pearson', center_data = False,
corrcoef_only = False, **kwargs):
"""
Initialize
Parameters
----------
dataset : Dataset with N samples such that corresponding dissimilarity
matrix has N*(N-1)/2 unique pairwise distances
target_dsm : numpy array, length N*(N-1)/2. Target dissimilarity matrix
partial_dsm: numpy array, length N*(N-1)/2. DSM to be partialled out
Default: 'None'; assumes use of pcorr.py
pairwise_metric : To be used by pdist to calculate dataset DSM
Default: 'correlation',
see scipy.spatial.distance.pdist for other metric options.
comparison_metric : To be used for comparing dataset dsm with target dsm
Default: 'pearson'. Options: 'pearson' or 'spearman'
center_data : Center data by subtracting mean column values from
columns prior to calculating dataset dsm.
Default: False
corrcoef_only : If true, return only the correlation coefficient
(rho), otherwise return rho and probability, p.
Default: False
Returns
-------
Dataset : Dataset contains the correlation coefficient (rho) only or
rho plus p, when corrcoef_only is set to false.
"""
# init base classes first
Measure.__init__(self, **kwargs)
if comparison_metric not in ['spearman','pearson']:
raise Exception("comparison_metric %s is not in "
"['spearman','pearson']" % comparison_metric)
self.target_dsm = target_dsm
if comparison_metric == 'spearman':
self.target_dsm = rankdata(target_dsm)
self.pairwise_metric = pairwise_metric
self.comparison_metric = comparison_metric
self.center_data = center_data
self.corrcoef_only = corrcoef_only
self.partial_dsm = partial_dsm
if comparison_metric == 'spearman' and partial_dsm != None:
self.partial_dsm = rankdata(partial_dsm)
开发者ID:zingbretsen,项目名称:RyMVPA,代码行数:44,代码来源:rsa.py
示例8: __init__
def __init__(self, target_dsm, control_dsms = None, **kwargs):
"""
Parameters
----------
target_dsm : array (length N*(N-1)/2)
Target dissimilarity matrix
control_dsms : list of arrays (each length N*(N-1)/2)
Dissimilarity matrices to control for in multiple regression; flexible number allowed
*Optional. Returns r/rho coefficients for target_dsm, controlling for these dsms
Returns
-------
Dataset
If ``corrcoef_only`` is True, contains one feature: the correlation
coefficient (rho); or otherwise two-fetaures: rho plus p.
"""
# init base classes first
Measure.__init__(self, **kwargs)
self.target_dsm = target_dsm
self.control_dsms = control_dsms
if self.params.comparison_metric == 'spearman':
self.target_dsm = rankdata(target_dsm)
if control_dsms != None: self.control_dsms = [rankdata(dm) for dm in control_dsms]
开发者ID:rystoli,项目名称:PyMVPA,代码行数:23,代码来源:rsa.py
示例9: __init__
def __init__(self):
Measure.__init__(self, auto_train=True)
开发者ID:kirty,项目名称:PyMVPA,代码行数:2,代码来源:test_searchlight.py
示例10: __init__
def __init__(self, **kwargs):
Measure.__init__(self, **kwargs)
开发者ID:Arthurkorn,项目名称:PyMVPA,代码行数:2,代码来源:test_surfing.py
示例11: __init__
def __init__(self, metric='pearson', space='targets', **kwargs):
Measure.__init__(self, **kwargs)
self.metric = metric
self.space = space
开发者ID:andreirusu,项目名称:PyMVPA,代码行数:4,代码来源:rsm.py
示例12: __init__
def __init__(self, **kwargs):
Measure.__init__(self, **kwargs)
self._train_ds = None
开发者ID:PyMVPA,项目名称:PyMVPA,代码行数:3,代码来源:rsa.py
示例13: __init__
def __init__(self, model='regression', cthresh=0.10):
Measure.__init__(self)
self.cthresh = cthresh
self.model = model
开发者ID:PepGardiola,项目名称:PyMVPA,代码行数:4,代码来源:ismooth.py
示例14: __init__
def __init__(self, dtype, **kwargs):
Measure.__init__(self, **kwargs)
self.dtype = dtype
开发者ID:StevenLOL,项目名称:PyMVPA,代码行数:3,代码来源:test_surfing_afni.py
注:本文中的mvpa2.measures.base.Measure类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论