mne_rsa.rsa#

mne_rsa.rsa(rdm_data, rdm_model, metric='spearman', ignore_nan=False, n_data_rdms=None, n_jobs=1, verbose=False)[source]#

Perform RSA between data and model RDMs.

Parameters:
rdm_datandarray, shape (n_items, n_items) | list | generator

The data RDM (or list/generator of data RDMs).

rdm_modelndarray, shape (n_items, n_items) | list of ndarray

The model RDM (or list of model RDMs).

metricstr

The RSA metric to use to compare the RDMs. Valid options are:

  • ‘spearman’ for Spearman’s correlation (the default)

  • ‘pearson’ for Pearson’s correlation

  • ‘kendall-tau-a’ for Kendall’s Tau (alpha variant)

  • ‘partial’ for partial Pearson correlations

  • ‘partial-spearman’ for partial Spearman correlations

  • ‘regression’ for linear regression weights

Defaults to ‘spearman’.

ignore_nanbool

Whether to treat NaN’s as missing values and ignore them when computing the distance metric. Defaults to False.

New in version 0.8.

n_data_rdmsint | None

The number of data RDMs. This is useful when displaying a progress bar, so an estimate can be made of the computation time remaining. This information is available if rdm_data is an array or a list, but if it is a generator, this information is not available and you may want to set it explicitly.

n_jobsint

The number of processes (=number of CPU cores) to use. Specify -1 to use all available cores. Defaults to 1.

verbosebool

Whether to display a progress bar. In order for this to work, you need the tqdm python module installed. Defaults to False.

Returns:
rsa_valfloat | ndarray, shape (len(rdm_data), len(rdm_model))

Depending on whether one or more data and model RDMs were specified, a single similarity value or a 2D array of similarity values for each data RDM versus each model RDM.

See also

rsa_gen