Giving credit

Table Of Contents

Previous topic

7.11.2. nilearn.signal.high_variance_confounds

Next topic

7.1.2. nilearn.connectome.GroupSparseCovariance


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.


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.


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.


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.


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

The input subjects time series.


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.


X : numpy array of shape [n_samples, n_features]

Training set.

y : numpy array of shape [n_samples]

Target values.


X_new : numpy array of shape [n_samples, n_features_new]

Transformed array.


Get parameters for this estimator.


deep: boolean, optional

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


params : mapping of string to any

Parameter names mapped to their values.


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.


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


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

The input subjects time series.


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

The transformed connectivity matrices.