This disclosure relates generally to sleep/wake tracking and machine learning.
Sleep deprivation can affect an individual's health, safety and quality of life. For example, sleep deprivation can affect the individual's ability to drive safely and may increase their risk of other health problems. Signs and symptoms of sleep disorders include excessive daytime sleepiness, irregular breathing, increased movement during sleep, irregular sleep and wake cycle and difficulty falling asleep. Some common types of sleep disorders include: Insomnia, in which the individual has difficulty falling asleep or staying asleep throughout the night, sleep apnea, in which the individual experiences abnormal patterns in breathing while they are asleep, restless legs syndrome (RLS), in which the individual experiences an uncomfortable sensation and urge to move their legs while trying to fall asleep and Narcolepsy, a condition characterized by the individual falling asleep suddenly during the day. Doctors can usually treat most sleep disorders effectively once the disorders are correctly diagnosed. To properly diagnose a sleep disorder, doctor's must understand the patient's sleep patterns during the night. Self-reporting of sleep patterns by the patient are often inaccurate. For example, many people with sleep apnea are unaware of it, many people with Insomnia perceive less sleep than is measured and most normal people are unaware that they wake up 10-20 times per night.
To understand a patient's sleep patterns, doctors will typically perform objective sleep staging by monitoring Electroencephalographic (EEG) activity during sleep. An EEG is a test that detects electrical activity in the brain using electrodes attached to the scalp. A patient's brain cells communicate using electrical impulses and are active all the time even when the patient is asleep. Because sleeping with electrodes attached to the scalp can be cumbersome, other sensors for monitoring sleep patterns have been developed, such as wearable devices and in bed sensors. Wearable devices are typically worn on the wrist, legs or chest and include motion sensors (e.g., accelerometers) for tracking movements at those locations. In bed sensors are typically placed under a bed sheet and include sensors that can track breathing and heart rate by measuring tiny body movements that occur when a user breathes, or their heart beats. The sensor data can be input into a sleep staging application installed on a smartphone or other device. The sleep staging application computes various sleep metrics, such as total sleep/wake time and sleep efficiency, which can be used to quantify sleep to help users improve the amount of sleep they get, and to allow the sleep/wake tracking application to coach the users on how to get more sleep.
Embodiments are disclosed for sleep/wake tracking using machine learning.
In an embodiment, a method comprises: receiving, with at least one processor, sensor signals from a sensor, the sensor signals including at least motion signals and respiratory signals of a user; extracting, with the at least one processor, features from the sensor signals; predicting, with a machine learning classifier, that the user is asleep or awake based on the features; and computing, with the at least one processor, a sleep or wake metric based on whether the user is predicted to be asleep or awake.
In an embodiment, the features include at least respiratory rate variability, respiratory amplitude variability, movement periods and movement amplitudes.
In an embodiment, prior to extracting the features the features are transformed to approximate a specified distribution, and after the features are extracted the features are scaled to generalize the features.
In an embodiment, the method further comprises: estimating, with a temporal model, a path of sleep stage probabilities to improve the predicted sleep and wake probabilities based at least in part on transition probabilities.
In an embodiment, the temporal model includes a Viterbi path for providing the transition probabilities.
In an embodiment, the features include time-domain features and frequency-domain features.
In an embodiment, the frequency-domain features are computed by: low-pass filtering the sensor signals to remove noise; downsampling the filtered sensor signals; extracting, with a first window function, a first portion of the sensor signals; computing a mean of the first portion of the sensor signals; subtracting the mean from the first portion of the sensor signals; extracting, with a second window function, a second portion of the sensor signals; computing a frequency spectrum of the second portion of the sensor signals; and computing the frequency-domain features based at least in part on the frequency spectrum.
In an embodiment, the time-domain features are computed by: generating, with an activity detector, a stream of movement periods and amplitudes; extracting, with a window function, a portion of the movement periods and amplitudes; and computing, as the time-domain features, a fraction of time labeled as movement by the activity detector, a mean movement amplitude and maximum movement amplitude.
In an embodiment, the time-domain features are computed by: generating, with a breath detector, one or more streams of breath cycle lengths and breath cycle amplitudes; extracting, with one or more window functions, one or more portions of the one or more streams; and computing, as the time-domain features, at least one of a number of breaths, standard deviation, mean absolute deviation, root-mean-square (RMS) of successive differences, mean average deviation (MAD) of successive differences and range.
In an embodiment, the method of claim 1, wherein at least one feature is based on availability of sensor signals.
Other embodiments can include an apparatus, computing device and non-transitory, computer-readable storage medium.
Particular embodiments disclosed herein provide one or more of the following advantages. Machine learning is used to improve prediction of sleep/wake states that can be used by a sleep/wake tracking application to generate a variety of sleep metrics that can be used to quantify sleep to help users improve the amount of sleep they get, and to allow the sleep/wake tracking application to coach users on how to get more sleep.
The details of one or more implementations of the subject matter are set forth in the accompanying drawings and the description below. Other features, aspects and advantages of the subject matter will become apparent from the description, the drawings and the claims.
In an embodiment, ML classifier 202 outputs a “sleep” or “wake” label and a probability of sleep or wake as a measure of confidence in the prediction (hereinafter, also referred to as “confidence score”). For example, if ML classifier 202 predicts an epoch of “sleep” with a 0.45 probability, that epoch would be classified as “wake” because its probability would be less than a specified threshold value (e.g., 0.55 in this example; sleep and wake probabilities add to one). Different probability thresholds can be used to tune the algorithm to more likely predict sleep or wake for any given epoch. From a full night of sleep/wake predictions, other derived metrics can be computed. For example, the Total Sleep Time metric can be computed by summing the sleep times between Sleep Onset and Sleep Offset. In another embodiment, ML classifier 202 generates a probability for each sleep stage (Wake, REM, NREM1, NREM2, NREM3), and the stage with the highest probability is chosen as the predicted stage.
In an embodiment, the sleep/wake tracking device is a Beddit™ sleep tracker developed by Beddit™ Oy of Espoo Finland, which is an in bed sensor that connects to a smart phone or other companion device (e.g., a tablet computer, wearable device) using Bluetooth™ technology. The Beddit™ sleep tracker is a thin sensor strip that can be hidden under a bed sheet and includes a piezo force sensor and a capacitive touch sensor. Also included is a humidity sensor and a temperature sensor located in a dongle near the plug, as shown in
Process 300 begins by filtering and resampling 303 sensor signals 301 (e.g., piezo signals) received from one or more sensors of a sleep/wake tracking device (e.g., an in bed sensor) to remove out of band noise. In an embodiment, the sensor signals include a piezo source signal that is sensitive to movements of the user's body due to breathing (from chest wall expansion), heart beats (from small movements related to the pumping of blood) and gross movement from shifting body positions or moving limbs. In an embodiment, the sensor signals representing heart rate (HR) are band passed filtered for a specified frequency band (e.g., between 0.5-40 Hz), the sensor signals representing breathing cycles is high pass filtered to remove low-frequency content (e.g., frequencies below 1 Hz) and the acceleration signal representing user body motion is high pass filtered to remove frequency content below a threshold (e.g., 10 Hz). In an embodiment, contributions to the sensor signals from movement, breathing and heart rate of a co-sleeper are detected and filtered from the sensor signals. In an embodiment, sensor signals are received from two or more sleep/wake tracking devices. In an embodiment, source signal separation techniques, such as independent component analysis or adaptive filtering, may be used to separate signals generated by two sleepers.
After filtering and resampling 303, epoching 304 is applied to the filtered signals. Epoching 304 generates windowed segments of the filtered peripheral signals for use by subsequent functions in process 300.
After epoching 304, feature transformation 305 is applied to the windowed segments. In an embodiment, feature transformation 305 transforms the features in the segments so the features are closer to a normal distribution. For example, a log transform can be applied to the segments to handle heavily skewed distributions.
After feature transformation 305, feature extraction 306 is applied to the transformed segments. Feature extraction 306 extracts features that may be informative for sleep/wake classification. Some examples features useful for sleep/wake classification include but are not limited to: HR, HRV, RRV and Activity detection. Additional example features are described in reference to
After feature extraction 306, feature scaling 307 is applied to the extracted features to allow better generalization across subjects. For example, features in the 5th percentile and 95th percentile of a normal distribution can be scaled to 0 and 1, respectively, with zero mean and unit variance. In an embodiment, a tan h( ) function is applied to the features to reduce the effect of outliers and limit the range from −1 to 1.
After feature scaling 307, the scaled features are input into epoch classifier 308. Epoch classifier 308 predicts at each epoch a probability of the user being asleep or awake. In an embodiment, logistic regression is used to obtain sleep/wake probabilities based on the scaled features for each epoch.
The sleep stage probabilities output by epoch classifier 308 are input into temporal model 309, which improves the predictions by taking into account the temporal order of the epochs. In an embodiment, a deep neural network is used in place of epoch classifier 308 and temporal model 309, as described in reference to
In an embodiment, a Viterbi path search, using learned sleep stage transition probabilities, is used to estimate the best sequence of sleep states (e.g. sleep/wake, or wake/REM/NREM1/NREM2/NREM3) over a period of time (e.g., over the course of night). The output of temporal model 309 are the final sleep stage predictions 310, which are used to compute sleep metrics 311. For example, Total Sleep Time can be computed by summing the epochs where a sleep state was predicted, i.e., summing the sleep times between wake bouts. The Viterbi path search utilizes the output probabilities from epoch classifier 308 as the state probabilities for each time-step, and finds the sequence of states that provides a maximum a posteriori probability. The state-transition probabilities (probability of transitioning between sleep stages) can be learned from a separate dataset.
In an embodiment, the time-domain movement detection path includes an activity detection module 402 that outputs a stream of movement states (“moving” or “not-moving”) and associated movement amplitudes whenever movement occurred. Window function 403 accumulates all movement periods and amplitudes within a window of N seconds (e.g., N=60). This window is shifted across the processing duration (e.g., whole night). Time-domain movement feature extractor 404 computes, from the window of movement periods and amplitudes, a mean movement amplitude, a maximum movement amplitude and a fraction of time the movement periods were labeled as movement by the classifier in the activity detection module 402. These time-domain movement features are then input into the sequencer classifier 312 shown in
In an embodiment, the time-domain respiratory cycle extraction path includes a breath detection module 405 that outputs a stream of breath cycle lengths and a stream of breath cycle amplitudes. Window function 406 accumulates breath cycle lengths and amplitudes within an N second window (e.g., N=60), and time-domain respiratory feature extractor 407 extracts portions of the breath cycle lengths and breath cycle amplitudes for computing time-domain respiratory features. For example, from the respective windows of breath cycle lengths and breath cycle amplitudes, time-domain respiratory feature extractor 407 computes a standard deviation (SD), mean absolute deviation, root-mean-square (RMS) of successive differences, a mean average deviation (MAD) of successive differences and range can be computed as time-domain respiratory features to be input into the sequencer classifier 312 shown in
In an embodiment, the frequency-domain respiratory analysis path includes spectrum generator module 408, such as a Fast Fourier Transform (FFT), which outputs a frequency spectrum for the piezo signal. Prior to applying the frequency transformation, the raw piezo force signal 401 can be low-pass filtered to remove unwanted low-frequency noise. The signal is then downsampled and windowed. Additionally, the mean of the windowed data can be computed and subtracted from the windowed data and another window (e.g., Hann window) applied prior to the frequency transformation. In an embodiment, the frequency spectrum output of the FFT is folded (e.g., three harmonics), and the signal to noise (SNR) of peak power over power elsewhere in the spectrum is computed. The spectrum and SNR can be used by frequency-domain respiratory analysis module 409 computes a variety of frequency-domain respiratory features for input into the sequencer classifier 312 shown in
In an embodiment, an additional feature is detected by missing data detector 410 based on the availability of data. This feature is “1” if, for any reason, there is not a full window of data available to compute all the features. This can occur, for example, when the user gets out of bed and the Bluetooth streaming disconnects and reconnects.
Note that the processing paths and features generated by the paths described above are examples, and more or fewer paths/features can be used/extracted to provide more or fewer features as input into sequence classifier 312 shown in
Classifier 500 receives feature vector 500 containing features for a whole night. The features can include, for example, all or some of the features described in reference to
Classifier 500 can be trained using back propagation techniques and annotated training data sets comprising data collected from sleep study participants. In other embodiments, other classification techniques can be used, such as a logistic regression, support vector machines (SVM), Extra Trees, Random Forests, Gradient Boosted Trees, Extreme Learning Machine (ELM), Perceptron and multi-layered convolutional neural networks.
Process 600 includes the steps of receiving sensor signal(s) indicating a user's respiratory cycle and movement (601), extracting features from the sensor signal(s) (602), predicting, using machine learning model, sleep and/or wake states of the user based on the features (603), and computing sleep metric(s), based on the predicted sleep and/or wake states (604). Each of the preceding steps were described in detail in reference to
Sensors, devices and subsystems can be coupled to peripherals interface 706 to provide multiple functionalities. For example, one or more motion sensors 710, light sensor 712 and proximity sensor 714 can be coupled to peripherals interface 706 to facilitate motion sensing (e.g., acceleration, rotation rates), lighting and proximity functions of the wearable device. Location processor 715 can be connected to peripherals interface 706 to provide geo-positioning. In some implementations, location processor 715 can be a GNSS receiver, such as the Global Positioning System (GPS) receiver. Electronic magnetometer 716 (e.g., an integrated circuit chip) can also be connected to peripherals interface 706 to provide data that can be used to determine the direction of magnetic North. Electronic magnetometer 716 can provide data to an electronic compass application. Motion sensor(s) 710 can include one or more accelerometers and/or gyros configured to determine change of speed and direction of movement. Barometer 717 can be configured to measure atmospheric pressure. Sleep/wake tracking subsystem 720 receives sensor signals from a sleep tracking device through a wired connection.
Communication functions can be facilitated through wireless communication subsystems 724, which can include radio frequency (RF) receivers and transmitters (or transceivers) and/or optical (e.g., infrared) receivers and transmitters. The specific design and implementation of the communication subsystem 724 can depend on the communication network(s) over which a mobile device is intended to operate. For example, architecture 700 can include communication subsystems 724 designed to operate over a GSM network, a GPRS network, an EDGE network, a Wi-Fi™ network and a Bluetooth™ network. In particular, the wireless communication subsystems 724 can include hosting protocols, such that the mobile device can be configured as a base station for other wireless devices. In an embodiment, wireless communication subsystems 724 includes a Bluetooth™ protocol stack for pairing with a sleep/wake tracking device, and for transferring sensor signals from the sleep-wake tracking device, such as the Beddit™ in bed sleep/wake tracking device.
Audio subsystem 726 can be coupled to a speaker 728 and a microphone 730 to facilitate voice-enabled functions, such as voice recognition, voice replication, digital recording and telephony functions. Audio subsystem 726 can be configured to receive voice commands from the user.
I/O subsystem 740 can include touch surface controller 742 and/or other input controller(s) 744. Touch surface controller 742 can be coupled to a touch surface 746. Touch surface 746 and touch surface controller 742 can, for example, detect contact and movement or break thereof using any of a plurality of touch sensitivity technologies, including but not limited to capacitive, resistive, infrared and surface acoustic wave technologies, as well as other proximity sensor arrays or other elements for determining one or more points of contact with touch surface 746. Touch surface 746 can include, for example, a touch screen or the digital crown of a smart watch. I/O subsystem 740 can include a haptic engine or device for providing haptic feedback (e.g., vibration) in response to commands from processor 704. In an embodiment, touch surface 746 can be a pressure-sensitive surface.
Other input controller(s) 744 can be coupled to other input/control devices 748, such as one or more buttons, rocker switches, thumb-wheel, infrared port and USB port. The one or more buttons (not shown) can include an up/down button for volume control of speaker 728 and/or microphone 730. Touch surface 746 or other controllers 744 (e.g., a button) can include, or be coupled to, fingerprint identification circuitry for use with a fingerprint authentication application to authenticate a user based on their fingerprint(s).
In one implementation, a pressing of the button for a first duration may disengage a lock of the touch surface 746; and a pressing of the button for a second duration that is longer than the first duration may turn power to the mobile device on or off. The user may be able to customize a functionality of one or more of the buttons. The touch surface 746 can, for example, also be used to implement virtual or soft buttons.
In some implementations, the mobile device can present recorded audio and/or video files, such as MP3, AAC and MPEG files. In some implementations, the mobile device can include the functionality of an MP3 player. Other input/output and control devices can also be used.
Memory interface 702 can be coupled to memory 750. Memory 750 can include high-speed random access memory and/or non-volatile memory, such as one or more magnetic disk storage devices, one or more optical storage devices and/or flash memory (e.g., NAND, NOR). Memory 750 can store operating system 752, such as the iOS operating system developed by Apple Inc. of Cupertino, Calif. Operating system 752 may include instructions for handling basic system services and for performing hardware dependent tasks. In some implementations, operating system 752 can include a kernel (e.g., UNIX kernel).
Memory 750 may also store communication instructions 754 to facilitate communicating with one or more additional devices, one or more computers and/or one or more servers, such as, for example, instructions for implementing a software stack for wired or wireless communications with other devices, such as a sleep/wake tracking device. Memory 750 may include graphical user interface instructions 756 to facilitate graphic user interface processing; sensor processing instructions 758 to facilitate sensor-related processing and functions; phone instructions 760 to facilitate phone-related processes and functions; electronic messaging instructions 762 to facilitate electronic-messaging related processes and functions; web browsing instructions 764 to facilitate web browsing-related processes and functions; media processing instructions 766 to facilitate media processing-related processes and functions; GNSS/Location instructions 768 to facilitate generic GNSS and location-related processes and instructions; and sleep/Wake estimator instructions 770 that implement the machine learning model and feature extraction processes described in reference to
Each of the above identified instructions and applications can correspond to a set of instructions for performing one or more functions described above. These instructions need not be implemented as separate software programs, procedures, or modules. Memory 750 can include additional instructions or fewer instructions. Furthermore, various functions of the mobile device may be implemented in hardware and/or in software, including in one or more signal processing and/or application specific integrated circuits.
The described features can be implemented advantageously in one or more computer programs that are executable on a programmable system including at least one programmable processor coupled to receive data and instructions from, and to transmit data and instructions to, a data storage system, at least one input device, and at least one output device. A computer program is a set of instructions that can be used, directly or indirectly, in a computer to perform a certain activity or bring about a certain result. A computer program can be written in any form of programming language (e.g., SWIFT, Objective-C, C#, Java), including compiled or interpreted languages, and it can be deployed in any form, including as a stand-alone program or as a module, component, subroutine, a browser-based web application, or other unit suitable for use in a computing environment.
While this specification contains many specific implementation details, these should not be construed as limitations on the scope of any inventions or of what may be claimed, but rather as descriptions of features specific to particular embodiments of particular inventions. Certain features that are described in this specification in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable sub combination. Moreover, although features may be described above as acting in certain combinations and even initially claimed as such, one or more features from a claimed combination can in some cases be excised from the combination, and the claimed combination may be directed to a sub combination or variation of a sub combination.
Similarly, while operations are depicted in the drawings in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order, or that all illustrated operations be performed, to achieve desirable results. In certain circumstances, multitasking and parallel processing may be advantageous. Moreover, the separation of various system components in the embodiments described above should not be understood as requiring such separation in all embodiments, and it should be understood that the described program components and systems can generally be integrated together in a single software product or packaged into multiple software products.
As described above, some aspects of the subject matter of this specification include gathering and use of data available from various sources to improve services a mobile device can provide to a user. The present disclosure contemplates that in some instances, this gathered data may identify a particular location or an address based on device usage. Such personal information data can include location-based data, addresses, subscriber account identifiers, or other identifying information.
The present disclosure further contemplates that the entities responsible for the collection, analysis, disclosure, transfer, storage, or other use of such personal information data will comply with well-established privacy policies and/or privacy practices. In particular, such entities should implement and consistently use privacy policies and practices that are generally recognized as meeting or exceeding industry or governmental requirements for maintaining personal information data private and secure. For example, personal information from users should be collected for legitimate and reasonable uses of the entity and not shared or sold outside of those legitimate uses. Further, such collection should occur only after receiving the informed consent of the users. Additionally, such entities would take any needed steps for safeguarding and securing access to such personal information data and ensuring that others with access to the personal information data adhere to their privacy policies and procedures. Further, such entities can subject themselves to evaluation by third parties to certify their adherence to widely accepted privacy policies and practices.
In the case of advertisement delivery services, the present disclosure also contemplates embodiments in which users selectively block the use of, or access to, personal information data. That is, the present disclosure contemplates that hardware and/or software elements can be provided to prevent or block access to such personal information data. For example, in the case of advertisement delivery services, the present technology can be configured to allow users to select to “opt in” or “opt out” of participation in the collection of personal information data during registration for services.
Therefore, although the present disclosure broadly covers use of personal information data to implement one or more various disclosed embodiments, the present disclosure also contemplates that the various embodiments can also be implemented without the need for accessing such personal information data. That is, the various embodiments of the present technology are not rendered inoperable due to the lack of all or a portion of such personal information data. For example, content can be selected and delivered to users by inferring preferences based on non-personal information data or a bare minimum amount of personal information, such as the content being requested by the device associated with a user, other non-personal information available to the content delivery services, or publicly available information.