frites.estimator.CorrEstimator#

class frites.estimator.CorrEstimator(method='pearson', implementation='vector', verbose=None)[source]#

Correlation-based estimator.

This estimator can be used to estimate the correlation between two continuous variables (mi_type=’cc’).

Parameters
method{‘pearson’, ‘spearman’}

Use either the Pearson correlation or the rank-based Spearman correlation

implementation{‘vector’, ‘tensor’}

Specify whether to use the traditional vector-based implementation or the tensor-based implementation (usually faster)

Methods

estimate(x, y[, z, categories])

Estimate the correlation between two variables.

get_function()

Get the function to execute according to the input parameters.

estimate(x, y, z=None, categories=None)[source]#

Estimate the correlation between two variables.

This method is made for computing the correlation on 3D variables (i.e (n_var, 1, n_samples)) where n_var is an additional dimension (e.g times, times x freqs etc.), and n_samples the number of samples.

Parameters
x, ynumpy:array_like

Array of shape (n_var, 1, n_samples).

categoriesnumpy:array_like | python:None

Row vector of categories. This vector should have a shape of (n_samples,) and should contains integers describing the category of each sample.

Returns
corrnumpy:array_like

Array of correlation of shape (n_categories, n_var).

get_function()[source]#

Get the function to execute according to the input parameters.

This can be particularly useful when computing correlation in parallel as it avoids to pickle the whole estimator and therefore, leading to faster computations.

The returned function has the following signature :

  • fcn(x, y, *args, categories=None, **kwargs)

and return an array of shape (n_categories, n_var).

Examples using frites.estimator.CorrEstimator#

Estimate the Dynamic Functional Connectivity

Estimate the Dynamic Functional Connectivity

Estimator comparison

Estimator comparison

Comparison between tensor and vector based computations

Comparison between tensor and vector based computations