Skip to content

Epoch Fragmentation when predicting for short epochs (yasa in mice)  #139

@matiasandina

Description

@matiasandina

I have been making some strides with my PhD project and still intend to migrate my predictions from Accusleep to yasa (#72). Not sure if you remember, but I used a public dataset labeled with Accusleep to train a yasa classifier that would work for mice. I haven't gotten down to making SleepStaging accept mice data yet because I am trying to make sure that the predictions are actually useful for me. I have multiple electrodes that I use for comparison between brain sites (and for quality control).

Overall, yasa's predictions are quite good and fast, but I do notice that there are two issues. First, there's obvious disagreement between channels, which could be potentially solved by taking the mode between channels. Notice that I'm predicting for 2 second epoch, so it's quite a lot of predictions and this jitter is somewhat expected. This is true for both yasa and Accusleep, but Accusleep has less dramatic differences between electrodes. Second, and more important, I notice that yasa's predictions are not as continuous as I would like (as compared with accusleep, which I think would be more similar to what a human can score). They are a bit fragmented. I tried to implement a few functions to smooth out these events (a rolling mode, and a function that replaces bouts with short duration using the previous values). I think it would be powerful to implement a method for binding the predictions into more logical chunks (either using my methods or extensions of them or using the probabilities from the SleepStaging itself).

If you have a moment to check the examples in the notebook, I'd appreciate it!

You can find the output of the quarto notebook in this branch:

https://github.com/matiasandina/yasa_classifier/tree/yasa-accusleep-eval

Either this notebook:

https://github.com/matiasandina/yasa_classifier/blob/yasa-accusleep-eval/sync_plots.ipynb

or this html file

https://github.com/matiasandina/yasa_classifier/blob/yasa-accusleep-eval/sync_plots.html is the output of the notebook.

I did not add the data so it's not possible to re-run it, but I did add the functions into src. This folder contains the implementation of the smoothing methods (likely inefficient and not fully tested, but it's a first approach).

Metadata

Metadata

Assignees

Labels

invalid 🚩This doesn't seem rightquestion 🙋Further information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions