Skip to content

Conversation

Genuster
Copy link
Contributor

@Genuster Genuster commented Jul 18, 2025

What does this implement/fix?

Adds SpatialFilter container for visualisation of filters, patterns and eigenvalues of GED-based algorithms (CSP, SPoC, SSD, XdawnTransformer) and other linear models (LinearModel).

  • implement plot_filters, plot_patterns, plot_scree
  • make possible to plot inverse_transform'ed filters/patterns in case of pipeline (as get_coef does)
    • make get_coef work with arbitrary step in the pipeline (not only the last LinearModel)
  • cover tests
  • replace CSP's plots with internal functions
  • make existing examples use the container's plotting methods

@wmvanvliet
Copy link
Contributor

I'm all for adding nice visualizations for filters/patterns. Suggestion: would a MixedIn pattern make sense here instead of the class you have now?

@Genuster
Copy link
Contributor Author

Cheers @wmvanvliet!

My original thought was to make it usable with external spatial filters (PyRiemann transformers, for example).
I also realize now if the relevant transformer is in the middle of the pipeline and I want visualize its filters/patterns after inverse-transform, it would make sense to use a plain function that would instantiate the Viz class instead of adding it as a method to GED/LinearModel.
If I go with Mixin this case would be problematic, as far as I can tell.

Does that make sense? If you have an idea how we can work around it with Mixin, I'd be glad to hear

@Genuster Genuster marked this pull request as ready for review July 30, 2025 08:16
@Genuster Genuster requested a review from larsoner as a code owner July 30, 2025 08:16
Copy link
Member

@larsoner larsoner left a comment

Choose a reason for hiding this comment

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

Looks like a good start! Needs some tutorial to show how it's useful though. Bonus points if you can modify some existing example to make it shorter and/or clearer

@Genuster
Copy link
Contributor Author

Genuster commented Aug 19, 2025

@larsoner, I think it's ready for the next round!
I didn't add a tutorial specifically for the class, but used most of the functionality across the examples, hope it's enough

Copy link
Member

@larsoner larsoner left a comment

Choose a reason for hiding this comment

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

Had a look at CircleCI, and some examples were unchanged (good), and this one looks better (good):

Just a tiny minor things then I think we're good to go!

@Genuster
Copy link
Contributor Author

@larsoner, if you don't have additional comments - it's ready ☺️

@larsoner larsoner merged commit 0474b49 into mne-tools:main Aug 22, 2025
32 checks passed
@larsoner
Copy link
Member

Thanks @Genuster !

@Genuster Genuster deleted the ged-viz branch August 22, 2025 19:20
@Genuster Genuster mentioned this pull request Aug 23, 2025
7 tasks
zEdS15B3GCwq pushed a commit to zEdS15B3GCwq/mne-python that referenced this pull request Aug 25, 2025
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Eric Larson <[email protected]>
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.

3 participants