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.

nilearn.connectome.GroupSparseCovariance#

class nilearn.connectome.GroupSparseCovariance(alpha=0.1, tol=0.001, max_iter=10, verbose=0, memory=Memory(location=None), memory_level=0)[source]#

Covariance and precision matrix estimator.

The model used has been introduced in [1], and the algorithm used is based on what is described in [2].

Parameters:
alphafloat, optional

regularization parameter. With normalized covariances matrices and number of samples, sensible values lie in the [0, 1] range(zero is no regularization: output is not sparse). Default=0.1.

tolpositive float, optional

The tolerance to declare convergence: if the dual gap goes below this value, iterations are stopped. Default=1e-3.

max_iterint, optional

maximum number of iterations. The default value is rather conservative. Default=10.

verboseint, optional

verbosity level. Zero means “no message”. Default=0.

memoryinstance of joblib.Memory or string, optional

Used to cache the masking process. By default, no caching is done. If a string is given, it is the path to the caching directory.

memory_levelint, optional

Caching aggressiveness. Higher values mean more caching. Default=0.

References

Attributes:
`covariances_`numpy.ndarray, shape (n_features, n_features, n_subjects)

empirical covariance matrices.

`precisions_`numpy.ndarraye, shape (n_features, n_features, n_subjects)

precisions matrices estimated using the group-sparse algorithm.

__init__(alpha=0.1, tol=0.001, max_iter=10, verbose=0, memory=Memory(location=None), memory_level=0)[source]#
fit(subjects, y=None)[source]#

Fits the group sparse precision model according to the given training data and parameters.

Parameters:
subjectslist of numpy.ndarray with shapes (n_samples, n_features)

input subjects. Each subject is a 2D array, whose columns contain signals. Sample number can vary from subject to subject, but all subjects must have the same number of features (i.e. of columns).

Returns:
selfGroupSparseCovariance instance

the object itself. Useful for chaining operations.

get_params(deep=True)#

Get parameters for this estimator.

Parameters:
deepbool, default=True

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

Returns:
paramsdict

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 Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Parameters:
**paramsdict

Estimator parameters.

Returns:
selfestimator instance

Estimator instance.