Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Improve sklearn compliance #13065

Merged
merged 12 commits into from
Jan 22, 2025
Merged

BUG: Improve sklearn compliance #13065

merged 12 commits into from
Jan 22, 2025

Conversation

larsoner
Copy link
Member

@larsoner larsoner commented Jan 14, 2025

This failure in mne-realtime is due to our poor sklearn compliance. This PR will ensure we at least pass some basic set of tests. So far I've only fixed some stuff for one estimator, need to add the others and fix them, too.

  • Move validation into fit step rather than __init__
  • Make it so that attributes that need to be changed are set during fit not __init__
  • Add more data validation options
  • Add compliance checks for all decoding classes
  • Ensure all examples still run with a [circle full]

Closes #11217

@larsoner larsoner changed the title WIP: Better sklearn compliance BUG: Improve sklearn compliance Jan 17, 2025
@larsoner
Copy link
Member Author

This one should be ready @drammock ! One example failed in circle full a couple of commits ago so I pushed a fix and modified the example.

mne/decoding/tests/test_base.py Show resolved Hide resolved
mne/decoding/search_light.py Outdated Show resolved Hide resolved
mne/decoding/time_frequency.py Outdated Show resolved Hide resolved
mne/time_frequency/multitaper.py Outdated Show resolved Hide resolved
mne/decoding/transformer.py Outdated Show resolved Hide resolved
mne/decoding/transformer.py Outdated Show resolved Hide resolved
@larsoner
Copy link
Member Author

Good now I think @drammock !

Copy link
Member

@drammock drammock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just one change to a comment. I'll apply it with [ci skip] and then merge manually, since CIs are already all green. Thanks @larsoner !

mne/decoding/transformer.py Outdated Show resolved Hide resolved
@drammock drammock merged commit 5f2b7f1 into mne-tools:main Jan 22, 2025
1 of 2 checks passed
@drammock drammock deleted the sklearn branch January 22, 2025 17:22
larsoner added a commit to larsoner/mne-python that referenced this pull request Jan 24, 2025
* upstream/main: (57 commits)
  Allow lasso selection sensors in a plot_evoked_topo (mne-tools#12071)
  MAINT: Fix doc build (mne-tools#13076)
  BUG: Improve sklearn compliance (mne-tools#13065)
  [pre-commit.ci] pre-commit autoupdate (mne-tools#13073)
  MAINT: Add Numba to 3.13 test (mne-tools#13075)
  Bump autofix-ci/action from ff86a557419858bb967097bfc916833f5647fa8c to 551dded8c6cc8a1054039c8bc0b8b48c51dfc6ef in the actions group (mne-tools#13071)
  [BUG] Correct annotation onset for exportation to EDF and EEGLAB (mne-tools#12656)
  New feature for removing heart artifacts from EEG or ESG data using a Principal Component Analysis - Optimal Basis Sets (PCA-OBS) algorithm (mne-tools#13037)
  [BUG] Fix taper weighting in computation of TFR multitaper power (mne-tools#13067)
  [FIX] Reading an EDF with preload=False and mixed frequency (mne-tools#13069)
  Fix evoked topomap colorbars, closes mne-tools#13050 (mne-tools#13063)
  [pre-commit.ci] pre-commit autoupdate (mne-tools#13060)
  BUG: Fix bug with interval calculation (mne-tools#13062)
  [DOC] extend documentation for add_channels (mne-tools#13051)
  Add `combine_tfr` to API (mne-tools#13054)
  Add `combine_spectrum()` function and allow `grand_average()` to support `Spectrum` data (mne-tools#13058)
  BUG: Fix bug with helium anon (mne-tools#13056)
  [ENH] Add option to store and return TFR taper weights (mne-tools#12910)
  BUG: viz plot window's 'title' argument showed no effect. (mne-tools#12828)
  MAINT: Ensure limited set of tests are skipped (mne-tools#13053)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update decoding classes for compliance with Scikit-Learn best practice
3 participants