Giving credit

Table Of Contents

Previous topic

7.11.2. nilearn.signal.high_variance_confounds

Next topic

7.1.2. nilearn.connectome.GroupSparseCovariance

Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the user guide for the big picture.

7.1.1. nilearn.connectome.ConnectivityMeasure

class nilearn.connectome.ConnectivityMeasure(cov_estimator=LedoitWolf(assume_centered=False, block_size=1000, store_precision=False), kind='covariance')

A class that computes different kinds of functional connectivity matrices.

New in version 0.2.

Parameters:

cov_estimator : estimator object, optional.

The covariance estimator. By default the LedoitWolf estimator is used. This implies that correlations are slightly shrunk towards zero compared to a maximum-likelihood estimate

kind : {“correlation”, “partial correlation”, “tangent”, “covariance”, “precision”}, optional

The matrix kind.

References

For the use of “tangent”, see the paper: G. Varoquaux et al. “Detection of brain functional-connectivity difference in post-stroke patients using group-level covariance modeling, MICCAI 2010.

Attributes

cov_estimator_ (estimator object) A new covariance estimator with the same parameters as cov_estimator.
mean_ (numpy.ndarray) The mean connectivity for the tangent kind.
whitening_ (numpy.ndarray) The inverted square-rooted geometric mean of the covariance matrices.
__init__(cov_estimator=LedoitWolf(assume_centered=False, block_size=1000, store_precision=False), kind='covariance')
fit(X, y=None)

Fit the covariance estimator to the given time series for each subject.

Parameters:

X : list of numpy.ndarray, shape for each (n_samples, n_features)

The input subjects time series.

Returns:

self : ConnectivityMatrix instance

The object itself. Useful for chaining operations.

fit_transform(X, y=None, **fit_params)

Fit to data, then transform it.

Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.

Parameters:

X : numpy array of shape [n_samples, n_features]

Training set.

y : numpy array of shape [n_samples]

Target values.

Returns:

X_new : numpy array of shape [n_samples, n_features_new]

Transformed array.

get_params(deep=True)

Get parameters for this estimator.

Parameters:

deep: boolean, optional

If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:

params : mapping of string to any

Parameter names mapped to their values.

set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The former have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns:self
transform(X)

Apply transform to covariances matrices to get the connectivity matrices for the chosen kind.

Parameters:

X : list of numpy.ndarray with shapes (n_samples, n_features)

The input subjects time series.

Returns:

output : numpy.ndarray, shape (n_samples, n_features, n_features)

The transformed connectivity matrices.