HypnogramHMM¶
Calculate a hypnogram (sleep scoring) from EEG observations and a specified initial observation model using a hidden Markov model (HMM) approach.
This node accepts a time series of features (but this can may be a non-feature axis, e.g. frequency for EEG power in several bands) and an observation matrix (really a block or packet) that relates these features to sleep stages. One axis of the observation matrix must be of the same type and length as the selected axis of features in the time series, and the other axis must be of length equal to the number of sleep stages. The observation matrix then represents, for each sleep stage, expected value of each feature (e.g., the expected power in each band). The node then calculates the most likely sequence of sleep stages given the observed features and output will correspondingly drop the chosen feature/frequency axis and replace it by a single-element feature axis that indicates the current numeric sleep stage (1-5). One may configure some additional initial parameters, such as the assumed initial sleep stage, the variance (uncertainty) associated with the initial observation model (a typical choice is to normalize the time series and set the variance to 1), and the initially assumed probability that a sleep stage transitions at any given 30s time step. The method can re-estimate iteratively all parameters of the model, or only some of them, according to the user's choice. More Info... Version 0.8.0
Ports/Properties¶
data¶
Data to process.
observation_model¶
Observation model.
obs_axis¶
Axis that enumerates the observable features described by the observation model.
decoder¶
Decoder algorithm. Viterbi finds the overall most likely sequence of states while MAP finds the individually most likely state at each time point.
reestimate_params¶
Parameters that the model is allowed to reestimate during fitting. startprob is represents the probability vector of being in a given initial state at the beginning of the session, transmat are the estimated transition probabilities between any given two sleep states, obs_means are the estimated average feature levels given any sleep state, and obs_covars are the estimated (co)variances of the feature levels given any sleep state.
initial_variance¶
Initial variance for the observation model. This is used to initialize the covariance matrix of the observation model.
initial_steady_prob¶
Initial probability of a sleep stage remaining steady from one time step to another (30s).
initial_wake_prob¶
Initial probability of being in the wake state at the beginning of a dataset.
min_covariance¶
Minimum covariance value to prevent overfitting.
randseed¶
Random seed. Only used if some parameters are being randomized (not used by default).
maxiter¶
Maximum number of iterations.
tolerance¶
Convergence tolerance. The algorithm will terminate if the gain in log-likelihood is less than this value.
outer_iter¶
Number of current outer iteration (0-based). This is for use with a debugging technique where precomputed data is output as a function of the iteration. Only respected if debug is set to True.
debug_source¶
Default source (root path) for debugging output. If this is set, the node will load and output predefined data from this root path that can be used to debug downstream results given previously saved known inputs.
verbose¶
Generate verbose output.
set_breakpoint¶
Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.
metadata¶
User-definable meta-data associated with the node. Usually reserved for technical purposes.