Skip to content

Extra eeg channels in automatic sleep staging #40

Closed

Description

@zixiao-yin

Fantastic work! I was wondering if it's possible to feed extra EEG channels (e.g., frontal and occipital channels) to yasa.SleepStaging.
Will this further improve the staging accuracy? I read the preprint paper but only central EEG is mentioned.
Thanks!

Activity

  1. self-assigned this
    on Oct 4, 2021
  2. raphaelvallat commented on Oct 4, 2021

    @raphaelvallat
    Owner

    Hi @zixiao-yin, thank you :-)

    For now only a single EEG channel is supported, preferentially C4-M1 or C3-M2. Adding support for multiple EEG channels in the core algorithm should be pretty straightforward, however we'll also need to retrain the classifier (see https://github.com/raphaelvallat/yasa_classifier). I don't think this will be implemented in the near future.

    Thanks,
    Raphael

  3. zixiao-yin commented on Oct 5, 2021

    @zixiao-yin
    Author

    Got it, Thanks Raphael!

  4. zixiao-yin commented on Oct 7, 2021

    @zixiao-yin
    Author

    Hi Raphael,
    Sorry to disturb. One more stupid question. Is yasa also supportable in detecting k-complexes and vertex sharp waves?
    Or I should switch to other tools to achieve this aim?

    Thank you very much!
    Zixiao

  5. raphaelvallat commented on Oct 7, 2021

    @raphaelvallat
    Owner

    Hi @zixiao-yin,

    You should be able to detect k-complexes with the yasa.sw_detect function. Make sure that you limit the detection to N2 sleep. Detection of sharp waves is not implemented.

    Thanks!
    Raphael

  6. umair-hassan commented on Jun 22, 2022

    @umair-hassan

    @raphaelvallat Just adding some weight to this issue. I think it will be quite useful to have the sleep stage in this way.

    I was thinking we may also generate two different hypnograms (using two different channels, one at a time of course given the current limitation) and combine the hypnograms on base of this probability index to yield in one final hypnogram? What do you think?

  7. raphaelvallat commented on Jun 24, 2022

    @raphaelvallat
    Owner

    Thanks @umair-hassan — I think this is a great idea. It will be better than having to re-train a separate classifier for 2, 3, ... n EEG channels, both in terms of ease-of-implementation, maintenance of the algorithm and maybe even accuracy.

    This should be pretty straightforward to do outside of YASA with the current implementation btw, but we could automatize this "majority voting" step within the SleepStaging class.

  8. umair-hassan commented on Jun 27, 2022

    @umair-hassan

    @raphaelvallat Thankyou for your assertion. I would write a pull request for this soon if no one has been assigned this issue yet then.

  9. umair-hassan commented on May 20, 2023

    @umair-hassan

    @raphaelvallat has this been completed? Otherwise I have time now to work on it!

  10. raphaelvallat commented on May 22, 2023

    @raphaelvallat
    Owner

    Hi @umair-hassan,

    Please do feel free to work on a PR. I appreciate it!

    Thanks
    Raphael

  11. Jhanyi commented on Dec 8, 2024

    @Jhanyi

    Thanks for the great package :)

    Reviving the question on K-complexes, are there consensus to say that K-complexes are simply N2 slow oscillations? while I do find some papers supporting this point, there are many others saying otherwise. There are also definitions for the KC waveform to be of complete reverse shape i.e. strong surface positive followed by strong surface negative) I have attached some screengrab from papers

    GetImage (1)

    image

    Halasz1998_Hierarchy_of_micro_arousals_and_the_microstructure_of_sleep.pdf

    GetImage

    https://www.scientificbulletin.upb.ro/rev_docs_arhiva/full782_186975.pdf

    of course they could easily be montage choices etc, but would be great if the detection could also take the reverse shaped waveform into accounrt. Happy to contribute of course

  12. remrama commented on Dec 8, 2024

    @remrama
    Collaborator

    I just copy/pasted the K-complex detection posts into a new Issue in #184 so that we can keep the conversation here limited to automatic sleep staging with extra EEG channels. 🤠

  13. Sleepy247365 commented on May 20, 2025

    @Sleepy247365

    Hi @umair-hassan,

    Please do feel free to work on a PR. I appreciate it!

    Thanks Raphael

    Please let me know if multiple eeg channel analysis was ever completed. Thank you!

  14. remrama commented on May 21, 2025

    @remrama
    Collaborator

    Thanks for checking in @Sleepy247365. This feature has not been implemented yet, and I don't think it's in super-high demand right now (but others please chime in if it's something you are eager to see). This conversation is a few years old so I doubt anyone is actively pursueing it, but it could definitely become a feature if anyone wants to pick it up.

  15. LIxxx-sketch commented on Mar 18, 2026

    @LIxxx-sketch

    Hi @raphaelvallat,
    I was thinking why do you set only one EEG channel when running yasa.SleepStaging? Why not include more EEG channels in order to improve the performance of the model at first?

  16. raphaelvallat commented on Mar 19, 2026

    @raphaelvallat
    Owner

    Hi @LIxxx-sketch, as discussed earlier in this thread, a model that natively support multiple EEG channels would require a full retraining and represent a significant effort on our side. A simpler workaround for now is to run SleepStaging N times with N different EEG channels (keeping the EOG and EMG constant).

    Furthermore, YASA's SleepStaging algorithm was intentionally designed to be lightweight, requiring only a single EEG channel. There are more accurate, deep learning-based algorithms out there that leverage all the available EEG channels, such as U-Sleep or gssc.

  17. LIxxx-sketch commented on Mar 20, 2026

    @LIxxx-sketch

    Hi @raphaelvallat, Thank you so much for answering my question! I see, the reason you designed it this way is to keep the model lightweight by using only one EEG channel. I am very interested in using YASA to run SleepStaging N times with N different EEG channels. And then, as discussed earlier in the thread, I'm going to do the 'majority voting' outside the YASA to see how it works.

  18. remrama commented on Mar 21, 2026

    @remrama
    Collaborator

    Just adding a comment to connect this with #236, where there's possibility of adding a new HypnogramSet class that would help perform things like majority voting on multiple scorers. The accepted answer here would be a good use case.

  19. Repository owner locked and limited conversation to collaborators on Mar 21, 2026
  20. converted this issue into a discussion #240 on Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions