Stress Prediction using HRV
Are you stressed?
No/Yes/Maybe……😕😕. Not able to identify?
Stress is a normal feeling. Stress is a feeling of emotional or physical tension. It can come from any event or thought that makes us feel frustrated, angry, or nervous. Stress is our body’s reaction to a challenge or demand. In short pressure, stress can be positive, such as when it helps you avoid danger or meet a deadline. But when stress lasts for a long time, it may harm your health.
Do we have any method or device which can tell us accurately if we are under stress or not? Yes, there are few devices which can speculate your stress level to some extent but their accuracy is still under the lenses.
But stress prediction using HRV has made it simpler and easier to detect your stress level.
So, let we first understand what is HRV?
Heart rate variability (HRV) is the physiological phenomenon of variation in the time interval between heartbeats. It is measured by the variation in the beat-to-beat interval.
Measurement of HRV for use in monitoring training and recovery involves analysis of the heart’s beat-to-beat variation. By accurately measuring the time interval between heartbeats, the detected variation can be used to measure the psychological and physiological stress and fatigue on the body during training.
Heart rate variability is the variance in time between the beats of your heart. So, if one’s heart rate is 60 beats per minute, it is not actually beating once every second. Within that minute there may be 0.9 seconds between two beats, for example, and 1.15 seconds between two others. The greater this variability is, the more “ready” the body is to execute at an elevated level.
These periods of time between successive heart beats are known as RR intervals (named for the heartbeat’s R-phase, the spikes seen on an ECG), measured in milliseconds.
HRV COMPUTATION
HRV indices are computed as follows: First, by extracting an inter-beat interval (IBI) signal from the peaks of the Electrocardiography (ECG) of each subject. Then, each HRV index is computed on a 5 minutes IBI array. A new IBI sample is appended to the IBI array while the oldest IBI sample is removed from its beginning. The new resulting IBI array is used to compute the next HRV index. This process is repeated until the end of the entire IBI signal.
How an ML model can use this HRV data to predict your stress level?
I came across a dataset called SWELL (open source), which is collected by researchers at the Institute for Computing and Information Sciences at Radboud University. It is a result of experiments conducted on 25 subjects doing typical office work (for example drafting reports, making presentations, reading e-mail, and searching for information). The subject went through typical working stressors such as receiving unexpected emails interruptions and pressure to complete their work on time. The experiment recorded various data including computer logging, facial expression, body postures, ECG signal, and skin conductance. The researchers also recorded the subjects’ subjective experience on task load, mental effort, emotion, and perceived stress. Each participant went through three different working conditions:
- no stress: the subjects are allowed to work on the tasks as long as they needed for a maximum of 45 minutes, but they are not aware of the maximum duration of their tasks.
- time pressure: during this time, the time to finish the task was reduced to 2/3 of the time the participant took in the neutral condition.
- interruption: the participants received eight emails in the middle of their assigned tasks. Some emails were relevant to their tasks — and the participant was requested to take specific actions — while others were just irrelevant to their tasks.
Using this dataset, I build an application which can predict a user’s stress level. A regular neural network model is used to train and test the results. It became a multilabel classification problem with dependent variable being condition of a person (no stress/time pressure/interruption). With almost 98.99% accuracy, model predicts the condition of a person.
Scope & use of this application
Application can be used to provide a real-time biofeedback from the wearable when a person undergoes stress. An alert can be sent in the form of a notification on the iPhone to prompt the user to use a meditation app, take rest or play a calm song through google home automatically. The data can also be recorded and be displayed using an app.
That’s it for now. This is my first post and I am working on my curation skills. If you like this Post, please follow me. If you have noticed any mistakes in the way of thinking or curation, please let me know.
Until Tomorrow!