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_dissimilarity_cv(dataset, descriptor, i_des, j_des, method='euclidean', noise=None, weighting='number', prior_lambda=1, prior_weight=0.1, cv_descriptor=None, enforce_same=False)[source]

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

Parameters
  • dataset (rsatoolbox.data.DatasetBase) – dataset to extract from

  • descriptor (String) – key for the descriptor defining the conditions

  • i_des – descriptor value the value of the first condition

  • j_des – descriptor value the value of the second condition

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

Returns

(value, weight)

value is the dissimilarity weight is the weight of the samples

Return type

(np.ndarray, np.ndarray)

rsatoolbox.rdm.calc_unbalanced.calc_one_similarity(dataset, descriptor, i_des, j_des, method='euclidean', noise=None, weighting='number', prior_lambda=1, prior_weight=0.1, cv_descriptor=None)[source]

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

Parameters
  • dataset (rsatoolbox.data.DatasetBase) – dataset to extract from

  • descriptor (String) – key for the descriptor defining the conditions

  • i_des – descriptor value the value of the first condition

  • j_des – descriptor value the value of the second condition

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

Returns

(value, weight)

value is the dissimilarity weight is the weight of the samples

Return type

(np.ndarray, np.ndarray)

rsatoolbox.rdm.calc_unbalanced.calc_one_similarity_small(dataset, descriptor, i_des, j_des, method='euclidean', noise=None, weighting='number', prior_lambda=1, prior_weight=0.1)[source]

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

Parameters
  • dataset (rsatoolbox.data.DatasetBase) – dataset to extract from

  • descriptor (String) – key for the descriptor defining the conditions

  • i_des – descriptor value the value of the first condition

  • j_des – descriptor value the value of the second condition

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

Returns

(value, weight)

value are the dissimilarities weight is the weight for the samples

Return type

(np.ndarray, np.ndarray)

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

calculate a RDM from an input dataset for unbalanced datasets.

Parameters
  • dataset (rsatoolbox.data.dataset.DatasetBase) – 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

Returns

RDMs object with the one RDM

Return type

rsatoolbox.rdm.rdms.RDMs

rsatoolbox.rdm.calc_unbalanced.dissimilarity(vec_i, vec_j, method, noise=None, prior_lambda=1, prior_weight=0.1)[source]
rsatoolbox.rdm.calc_unbalanced.dissimilarity_cv(vec_i, vec_j, vec_k, vec_l, method, noise=None, prior_lambda=1, prior_weight=0.1)[source]

helper function for crossvalidated distances

rsatoolbox.rdm.calc_unbalanced.similarity(vec_i, vec_j, method, noise=None, prior_lambda=1, prior_weight=0.1)[source]