rsatoolbox.rdm.calc_unbalanced module

Calculation of RDMs from unbalanced datasets, i.e. datasets with different channels or numbers of measurements per dissimilarity

@author: heiko

rsatoolbox.rdm.calc_unbalanced.calc_one_similarity(data_i: DatasetBase, data_j: DatasetBase, cv_desc_i: NDArray, cv_desc_j: NDArray, method='euclidean', noise=None, weighting='number', prior_lambda=1, prior_weight=0.1) Tuple[NDArray, NDArray][source]

finds all pairs of vectors to be compared and calculates one distance

  • data_i ( – dataset for condition i

  • data_j ( – dataset for condition j

  • cv_desc_i (numpy.ndarray) – crossvalidation descriptor for condition i

  • cv_desc_j (numpy.ndarray) – crossvalidation descriptor for condition j

  • method (string) – which dissimilarity to compute

  • noise – numpy.ndarray (n_channels x n_channels), optional the covariance or precision matrix over channels necessary for calculation of mahalanobis distances


(value, weight)

value is the dissimilarity weight is the weight of the samples

Return type

(np.ndarray, np.ndarray)

rsatoolbox.rdm.calc_unbalanced.calc_rdm_unbalanced(dataset: SingleOrMultiDataset, method='euclidean', descriptor=None, noise=None, cv_descriptor=None, prior_lambda=1, prior_weight=0.1, weighting='number', enforce_same=False) RDMs[source]

calculate a RDM from an input dataset for unbalanced datasets.

  • dataset ( – The dataset the RDM is computed from

  • method (String) – a description of the dissimilarity measure (e.g. ‘Euclidean’)

  • descriptor (String) – obs_descriptor used to define the rows/columns of the RDM

  • noise (numpy.ndarray) – dataset.n_channel x dataset.n_channel precision matrix used to calculate the RDM used only for Mahalanobis and Crossnobis estimators defaults to an identity matrix, i.e. euclidean distance


RDMs object with the one RDM

Return type