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

Method fit_transform

mne/decoding/csp.py:333–358  ·  view source on GitHub ↗

Fit CSP to data, then transform it. Fits transformer to ``X`` and ``y`` with optional parameters ``fit_params``, and returns a transformed version of ``X``. Parameters ---------- X : array, shape (n_epochs, n_channels, n_times) The data on which

(self, X, y=None, **fit_params)

Source from the content-addressed store, hash-verified

331 return X[:, np.newaxis, :] * self.patterns_[: self.n_components].T
332
333 def fit_transform(self, X, y=None, **fit_params):
334 """Fit CSP to data, then transform it.
335
336 Fits transformer to ``X`` and ``y`` with optional parameters ``fit_params``, and
337 returns a transformed version of ``X``.
338
339 Parameters
340 ----------
341 X : array, shape (n_epochs, n_channels, n_times)
342 The data on which to estimate the CSP.
343 y : array, shape (n_epochs,)
344 The class for each epoch.
345 **fit_params : dict
346 Additional fitting parameters passed to the :meth:`mne.decoding.CSP.fit`
347 method. Not used for this class.
348
349 Returns
350 -------
351 X_csp : array, shape (n_epochs, n_components[, n_times])
352 If ``self.transform_into == 'average_power'`` then returns the power of CSP
353 features averaged over time and shape is ``(n_epochs, n_components)``. If
354 ``self.transform_into == 'csp_space'`` then returns the data in CSP space
355 and shape is ``(n_epochs, n_components, n_times)``.
356 """
357 # use parent TransformerMixin method but with custom docstring
358 return super().fit_transform(X, y=y, **fit_params)
359
360 @legacy(alt="get_spatial_filter_from_estimator(clf, info=info).plot_patterns()")
361 @fill_doc

Callers 15

test_cspFunction · 0.95
test_regularized_cspFunction · 0.95
_fitMethod · 0.45
test_infomax_blowupFunction · 0.45
test_infomax_simpleFunction · 0.45
test_non_square_infomaxFunction · 0.45

Calls

no outgoing calls

Tested by 12

test_cspFunction · 0.76
test_regularized_cspFunction · 0.76
test_infomax_blowupFunction · 0.36
test_infomax_simpleFunction · 0.36
test_non_square_infomaxFunction · 0.36
test_filterestimatorFunction · 0.36
test_psdestimatorFunction · 0.36
test_temporal_filterFunction · 0.36
test_bad_triageFunction · 0.36
test_ssd_pipelineFunction · 0.36
test_linearmodelFunction · 0.36