JointPCADecomp

class JointPCADecomp(n_components=40, dim_red=<class 'sklearn.decomposition._pca.PCA'>)[source][source]
fit(X, y)[source][source]

Learns source-specific (e.g. patient-specific) transformations to the shared latent space and stores transformations in self.transforms.

Parameters:
  • X (list of ndarray) – List of features from multiple sources to compute shared latent space.

  • y (list of ndarray) – List of labels corresponding to feature sources. Must be the same length as features.

fit_transform(X, y)[source][source]

Fits the model with X and y and applies the learned transformations to X.

Parameters:
  • X (list of ndarray) – List of features from multiple sources to compute shared latent space.

  • y (list of ndarray) – List of labels corresponding to feature sources. Must be the same length as features.

Returns:

Tuple containing transformed ndarray data from all sources input to the fit() method. Length will be equal to the number of learned transformations.

Return type:

tuple

transform(X, idx=-1)[source][source]

Applies learned transformations to input data. Supports transforming a single, specified dataset or all-source datasets at once.

Parameters:
  • X (ndarray or list of ndarray) – Features to transform. If a list, the length must be equal to the number of learned transforms (i.e. transforming all sources). If an ndarray, a source-specific transformation is applied to the data, with the source specified by the idx input.

  • idx (int, optional) – Index of saved transform list to apply to single source data, or -1 if applying to all sources. Defaults to -1.

Raises:
  • IndexError – Error if idx is too large to select a learned transform from the saved list.

  • RuntimeError – Error if fit() has not been called before calling transform().

Returns:

Transformed data from single session if idx is not -1, or a tuple of containing:

Transformed data from all sources input to the fit() method. Length will be equal to the number of learned transformations.

Return type:

ndarray or tuple

Examples using ieeg.decoding.joint_pca.alignment_methods.JointPCADecomp

Joint pca decoding

Joint pca decoding