Skip to content

CSP.fit() requires y to work, however the parameter is optional in fit_transform() #10079

@hoechenberger

Description

@hoechenberger

Reported on the forum:

https://mne.discourse.group/t/can-not-do-csp-fit-transform-without-label/4072

Calling CSP.fit_transform() without y (which is alright according to the API, which defaults y=None) yields the following exception:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Users/long/anaconda/envs/3.6/lib/python3.6/site-packages/mne/decoding/mixin.py", line 30, in fit_transform
    return self.fit(X, **fit_params).transform(X)
TypeError: fit() missing 1 required positional argument: 'y'

This is because the fit_transform() method inherited from TransformerMixin is not compatible with the fit method implemented in CSP.

Solution is to give CSP its very own fit_transform method that doesn't make y an optional parameter.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions