Hidden Markov models
Behavpy has methods to train Hidden Markov Models (HMM) and use them to segment and predict sleep and awake stages in Drosophila. The approach is based on Wiggin et al., PNAS 2020.
In this section
Section titled “In this section”- Training an HMM: Curate movement data and train a categorical hidden Markov model of sleep and wake states with hmmlearn.
- Visualising with the HMM: Decode data with a trained HMM and plot the hidden states over time, their duration, their transitions and raw decoded sequences.