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.
- verbose name: Data
- default value: None
- port type: DataPort
- value type: Packet (can be None)
- data direction: INOUT
observation_model¶
Observation model.
- verbose name: Observation Model
- default value: None
- port type: DataPort
- value type: Packet (can be None)
- data direction: INOUT
obs_axis¶
Axis that enumerates the observable features described by the observation model.
- verbose name: Observables Axis
- default value: feature
- port type: ComboPort
- value type: str (can be None)
decoder¶
Decoder algorithm. Viterbi finds the overall most likely sequence of states while MAP finds the individually most likely state at each time point.
- verbose name: Decoder
- default value: viterbi
- port type: EnumPort
- value type: str (can be None)
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.
- verbose name: Reestimate Params
- default value: ['startprob', 'transmat', 'obs_means', 'obs_covars']
- port type: SubsetPort
- value type: list (can be None)
initial_variance¶
Initial variance for the observation model. This is used to initialize the covariance matrix of the observation model.
- verbose name: Initial Variance
- default value: 1.0
- port type: FloatPort
- value type: float (can be None)
initial_steady_prob¶
Initial probability of a sleep stage remaining steady from one time step to another (30s).
- verbose name: Initial Steady Prob
- default value: 0.95
- port type: FloatPort
- value type: float (can be None)
initial_wake_prob¶
Initial probability of being in the wake state at the beginning of a dataset.
- verbose name: Initial Wake Prob
- default value: 1.0
- port type: FloatPort
- value type: float (can be None)
min_covariance¶
Minimum covariance value to prevent overfitting.
- verbose name: Min Covariance
- default value: 0.001
- port type: FloatPort
- value type: float (can be None)
randseed¶
Random seed. Only used if some parameters are being randomized (not used by default).
- verbose name: Randseed
- default value: 12345
- port type: IntPort
- value type: int (can be None)
maxiter¶
Maximum number of iterations.
- verbose name: Maxiter
- default value: 50
- port type: IntPort
- value type: int (can be None)
tolerance¶
Convergence tolerance. The algorithm will terminate if the gain in log-likelihood is less than this value.
- verbose name: Tolerance
- default value: 0.0001
- port type: FloatPort
- value type: float (can be None)
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.
- verbose name: Outer Iter
- default value: None
- port type: IntPort
- value type: int (can be None)
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 name: Debug Source
- default value:
- port type: StringPort
- value type: str (can be None)
verbose¶
Generate verbose output.
- verbose name: Verbose
- default value: True
- port type: BoolPort
- value type: bool (can be None)
set_breakpoint¶
Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.
- verbose name: Set Breakpoint (Debug Only)
- default value: False
- port type: BoolPort
- value type: bool (can be None)
metadata¶
User-definable meta-data associated with the node. Usually reserved for technical purposes.
- verbose name: Metadata
- default value: {}
- port type: DictPort
- value type: dict (can be None)