top of page

Sleep and HRV Feature Engineering

DALL·E 2025-01-24 13.45.11 - A Garmin Fenix 7 smartwatch designed to resemble the Eye of S

The Importance of Sleep
We spend about one-third of our lives sleeping, making it more crucial than any daily activity for maintaining balanced health. Sleep is the foundation of physical recovery, mental clarity, and overall well-being.

  • Physical Recovery: Repairs muscles and promotes growth.

  • Mental Clarity: Boosts focus, memory, and decision-making.

  • Emotional Balance: Reduces stress, anxiety, and mood swings.

  • Immune Support: Strengthens your body’s defense against illness.

  • Athletic Performance: Enhances endurance, reaction times, and recovery.

  • Heart Health: Supports cardiovascular function and reduces inflammation.

  • Metabolism: Regulates hormones and helps maintain a healthy weight.

In a general overview of Sleep these are metrics that we get to see

Duration Score Stages of sleep HRV( Heart rate variability) etc

 

But in the Garmin dataset there is more to explore 

Key Metrics

Duration

Lets look at the sleep  data We have Sleep broken down by Deep light rem and awake  in seconds 

Screenshot 2025-01-22 at 6.16.24 PM.png

What are the ideals of sleep we should be getting ?

Am I getting ideal sleep some days yes some days no. there number will become a key metrics for overall recovery score that I would need to achieve  

Quality

Garmin also Qualifies the data so that there are insights that we can use 

Screenshot 2025-01-22 at 6.43.49 PM.png

In my analysis, I aim to dive deeper into this information, leveraging sentiment analysis to uncover patterns and enhance its usefulness so will break down these paramenters that we can use.

When we look at the Sankey flow analysis of the Sleep paramenters we can clearly see how the Sleep sentimnets can give us clear idea on what was the cause of it what are the breakups and finally if there are paramenters I can optimize for to get the best results 

HRV (Heart Rate Variability )

  1. HRV as a Metric:

    • HRV is a non-invasive measure of Autonomic Nervous System (ANS) balance.

    • It serves as a powerful indicator of Readiness to perform or recover, Overall health and Stress and fatigue levels.

  2. Why Sleep is Key: During sleep, the heart operates in a steady state, making HRV a reliable baseline for assessing ANS health. This “resting HRV” reflects recovery and resilience, helping track long-term trends.

  3. The ANS Connection:

    • Sympathetic Branch: Prepares the body for activity or stress (fight-or-flight).

    • Parasympathetic Branch: Facilitates recovery and relaxation (rest-and-digest).

    • Balance between these two systems is crucial, and HRV acts as a proxy for assessing this balance.

Garmin’s HRV Calculation

  • Optical Sensor and RR Intervals: Garmin devices use a PPG (Photoplethysmography) sensor to measure changes in blood flow, detecting RR intervals (time between consecutive heartbeats), These RR intervals are the foundation for HRV calculations.

  • Statistical Methodology: Root Mean Square of Successive Differences (RMSSD) which captures short-term variability in consecutive RR intervals. It is particularly sensitive to the parasympathetic nervous system’s activity, which controls recovery and relaxation.

  • Why RMSSD?: is preferred becauseIt excludes slower, long-term trends like circadian rhythms, focusing solely on rapid variations providing a robust, reliable snapshot of parasympathetic activity.

In the example  below I have taken my Raw data example where my HRV was in the range of score of 25 comparing it to a night where the HRV score was in the Range of 90

Looking at these RMSSD values alone might not make sense to most people, as they vary widely between individuals based on factors like age, fitness level, and genetics.

Garmin then applies a scaling factor based on personalised individual trends to RMSSD data to create a personalised HRV score ( 0–100 or similar).

Which then becomes easy to interpret and is Tailored to the individual

So in my case 

 

  • Low HRV (Score ~25): Reflects stress and or fatigue, requiring more recovery. In this state, the heart beats are less flexible in adapting to changes.

  • High HRV (Score ~90): Indicates a well-recovered state with good resilience and adaptability.

You can read up a lot more details on the Garmin website

garmin-2-logo-png-transparent.png

When we dig deeper into the sleep trend above you would see that there are days when the the time spent sleeping is ok but still the overall quality score for that night is not that great

HRV can be used as a easy measurable number that gives a good insight into what is actually happening in the sleep 

HRV Details

Garmin not only calculates the HRV details but also stores some of the Summarized versions of the metrics which makes it easier for us to analyze the data 

HRV cols.png

Key Metrics:


Avg heart Rate :A Lower Average HR during during sleep indicates effective recovery and a well-functioning parasympathetic system (rest-and-digest state)

HRV Nightly Avg: Represents the average HRV recorded nightly, giving a snapshot of recovery status per day.
HRV Weekly Avg: Averages the nightly HRV over the past week, smoothing out daily fluctuations and providing a medium-term view of recovery and stress trends.
HRV 5-Min High: The highest HRV value recorded in a 5-minute window, reflecting peak recovery moments.
HRV Baseline Low/Upper: These values define the balanced HRV range specific to the individual, ensuring personalized interpretation.
HRV Range: Categorical representation of the HRV in the range

Summary

Key Insights into HRV Relationships

hrv_correlation_heatmap.png

In our data, we have distilled key Sleep and HRV features that provide actionable insights and enhance the efficacy of our machine learning models:

Sleep Duration and stages: Total sleep time, segmented into deep, light, REM, and awake stages the importance of them 
Sleep Quality Indicators: Metrics such as restfulness, continuity, and restorative value, providing a qualitative assessment of sleep.
Heart Rate Variability (HRV) During Sleep: Analysis of HRV and its various components 
Sleep Sentiment Analysis: Application of sentiment analysis to sleep data to uncover patterns and enhance the usefulness of qualitative sleep assessments.

hrv_nightly_avg and hrv_5min_high (0.84): Strong alignment indicates that peak HRV contributes significantly to overall nightly recovery.
hrv_weekly_avg and hrv_nightly_avg (0.59): Weekly averages reflect trends in nightly recovery, supporting long-term autonomic health.

REM Sleep: Moderate correlation with HRV (hrv_nightly_avg: 0.42, hrv_5min_high: 0.40) highlights its role in recovery and autonomic balance.

Sleep Score: Strong correlation (hrv_nightly_avg: 0.67, hrv_5min_high: 0.62) shows higher HRV aligns with better sleep quality.

Resting Heart Rate: Strong negative correlation (hrv_nightly_avg: -0.83, hrv_5min_high: -0.74) links lower heart rates with better parasympathetic activation.
Stress Levels: Strong negative relationship (hrv_nightly_avg: -0.76, hrv_5min_high: -0.67) shows lower stress aligns with higher HRV.

 

 

Light Sleep: Weak correlation (hrv_5min_high: 0.21), indicating limited influence on recovery.
Deep Sleep: Weak correlation (hrv_5min_high: 0.18), showing less impact on HRV compared to REM sleep.

interactive graphs on desktop version

bottom of page