CCA_align_by_trial_subselect¶
- CCA_align_by_trial_subselect(X_a, X_b, y_a, y_b, return_space='b_to_a')[source][source]¶
CCA Alignment between 2 datasets with correspondence via subselection of trials within shared clases.
The number of features must be the same for datasets A and B. For example, if the datasets have different feature sizes, you can use PCA to reduce both datasets to the same number of PCs first.
- Parameters:
X_a (
ndarray) – Data matrix for dataset A of shape (n_trials_a, n_timepoints, n_features)X_b (
ndarray) – Data matrix for dataset B of shape (n_trials_b, n_timepoints, n_features)y_a (
ndarray) – Label matrix for dataset A of shape (n_trials_a, …). The first dimension must be the trial dimension. This can be a 1D array, or a 2D array if each trial has multiple labels (e.g. a sequence of phonemes). Label sequences are converted to a single string so that only the same label sequences have correspondence between the datasets.y_b (
ndarray) – Label matrix for dataset B of shape (n_trials_a, …). See y_a for more details.return_space (
str, optional) – How to perform alignment. Dataset B can be aligned to A, and vice versa (‘b_to_a’ and ‘a_to_b’, respectively), or both datasets can be aligned to a shared space (‘shared’). Defaults to ‘b_to_a’.
- Returns:
Tuple containing aligned data matrix for dataset A and dataset B.
- Return type: