Remove selected components from the signal. Given the unmixing matrix, transform data, zero out components, and inverse transform the data. This procedure will reconstruct the signals from which the dynamics described by the excluded components is subtracted.
(self, X)
| 211 | return X |
| 212 | |
| 213 | def inverse_transform(self, X): |
| 214 | """Remove selected components from the signal. |
| 215 | |
| 216 | Given the unmixing matrix, transform data, zero out components, |
| 217 | and inverse transform the data. This procedure will reconstruct |
| 218 | the signals from which the dynamics described by the excluded |
| 219 | components is subtracted. |
| 220 | |
| 221 | Parameters |
| 222 | ---------- |
| 223 | X : array, shape (n_epochs, n_components * n_classes, n_times) |
| 224 | The transformed data. |
| 225 | |
| 226 | Returns |
| 227 | ------- |
| 228 | X : array, shape (n_epochs, n_channels * n_classes, n_times) |
| 229 | The inverse transform data. |
| 230 | """ |
| 231 | # Check size |
| 232 | X = self._check_data(X, check_n_features=False) |
| 233 | n_epochs, n_comp, n_times = X.shape |
| 234 | if n_comp != (self.n_components * len(self.classes_)): |
| 235 | raise ValueError( |
| 236 | f"X must have {self.n_components * len(self.classes_)} components, " |
| 237 | f"got {n_comp} instead." |
| 238 | ) |
| 239 | pick_patterns = self._subset_multi_components(name="patterns") |
| 240 | # Transform |
| 241 | return np.dot(pick_patterns.T, X).transpose(1, 0, 2) |
| 242 | |
| 243 | |
| 244 | @verbose |