biopsykit.sleep.sleep_wake_detection.algorithms.webster module¶
Sleep/Wake detection using the Webster Algorithm.
- class biopsykit.sleep.sleep_wake_detection.algorithms.webster.Webster(**kwargs)[source]¶
Bases:
biopsykit.sleep.sleep_wake_detection.algorithms._base._SleepWakeBase
Class representing the Webster Algorithm for sleep/wake detection based on activity counts.
The Webster Algorithm runs sleep wake detection on epoch level activity data. Epochs are 1 minute long and activity is represented by an activity index which comes from Actigraph data or from raw acceleration data converted into activity index data.
- Parameters
scale_factor (float) – scale factor to use for the predictions (default corresponds to scale factor optimized for use with the activity index, if other activity measures are desired the scale factor can be modified or optimized.). Default: 0.025
References
add reference
- scale_factor: float¶
scale factor to use for the predictions (default corresponds to scale factor optimized for use with the activity index, if other activity measures are desired the scale factor can be modified or optimized.). Default: 0.025
- fit(data, **kwargs)[source]¶
Fit sleep/wake detection algorithm to input data.
Note
Algorithms that do not have to (re)fit a ML model before sleep/wake prediction, such as rule-based algorithms, will internally bypass this method as the
fit
step is not needed.- Parameters
data (array_like) – input data
- predict(data, **kwargs)[source]¶
Apply sleep/wake prediction algorithm on input data.
- Parameters
data (array_like) – input data with activity index values
**kwargs –
additional arguments to be passed to the algorithm for prediction, such as:
rescore_data
(bool
):True
to apply Webster’s rescoring rules to the sleep/wake predictions,False
otherwise. Default:True
epoch_length
(int
): activity data epoch lengths in seconds, i.e. Epoch lengths are usually 30 or 60 seconds. Default: 60
- Returns
dataframe with sleep/wake predictions
- Return type