MCPcopy
hub / github.com/mne-tools/mne-python / transform

Method transform

mne/decoding/transformer.py:211–236  ·  view source on GitHub ↗

Standardize data across channels. Parameters ---------- epochs_data : array, shape (n_epochs, n_channels[, n_times]) The data. Returns ------- X : array, shape (n_epochs, n_channels, n_times) The data concatenated over channel

(self, epochs_data)

Source from the content-addressed store, hash-verified

209 return self
210
211 def transform(self, epochs_data):
212 """Standardize data across channels.
213
214 Parameters
215 ----------
216 epochs_data : array, shape (n_epochs, n_channels[, n_times])
217 The data.
218
219 Returns
220 -------
221 X : array, shape (n_epochs, n_channels, n_times)
222 The data concatenated over channels.
223
224 Notes
225 -----
226 This function makes a copy of the data before the operations and the
227 memory usage may be large with big data.
228 """
229 check_is_fitted(self, "scaler_")
230 epochs_data = self._check_data(epochs_data, atleast_3d=False)
231 if epochs_data.ndim == 2: # can happen with SlidingEstimator
232 if self.info is not None:
233 assert len(self.info["ch_names"]) == epochs_data.shape[1]
234 epochs_data = epochs_data[..., np.newaxis]
235 assert epochs_data.ndim == 3, epochs_data.shape
236 return _sklearn_reshape_apply(self.scaler_.transform, True, epochs_data)
237
238 def fit_transform(self, epochs_data, y=None):
239 """Fit to data, then transform it.

Callers 4

fit_transformMethod · 0.45
fit_transformMethod · 0.45
fit_transformMethod · 0.45
fit_transformMethod · 0.45

Calls 2

_sklearn_reshape_applyFunction · 0.85
_check_dataMethod · 0.45

Tested by

no test coverage detected