mne_rsa.rsa

mne_rsa.rsa(dsm_data, dsm_model, metric='spearman', ignore_nan=False, n_data_dsms=None, n_jobs=1, verbose=False)[source]

Perform RSA between data and model DSMs.

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

The data DSM (or list/generator of data DSMs).

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

The model DSM (or list of model DSMs).

metricstr

The RSA metric to use to compare the DSMs. 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_dsmsint | None

The number of data DSMs. This is useful when displaying a progress bar, so an estimate can be made of the computation time remaining. This information is available if dsm_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(dsm_data), len(dsm_model))

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

See also

rsa_gen