How Lasso Analyzes Yoga Sessions: Detecting Phases Through Heart Rate Patterns
Understanding how we identify warm-up, active flow, long holds, and savasana phases from your heart rate data.
Introduction
Unlike high-intensity activities like running or weight training, yoga sessions have a more subtle heart rate signature. The challenge lies in distinguishing between different phases of practice—warm-up, active flow sequences, long-held poses, and final relaxation—when heart rate changes are gradual rather than dramatic. At Lasso, we've developed a sophisticated phase detection system that analyzes heart rate level, rate of change, and variability to automatically identify these distinct phases of your yoga practice.
The Four Yoga Phases
We classify yoga sessions into four distinct phases, each with characteristic heart rate patterns:
- Warm-up / Settling: Early in the session, heart rate gradually increases as you begin moving
- Active Flow: Higher heart rate with variability as you move through dynamic sequences
- Long Holds / Floor Work: Moderate, stable heart rate during held poses and floor-based work
- Cool-down / Savasana: Heart rate gradually decreases during final relaxation
Step 1: Data Preprocessing
Parsing Heart Rate Data
Most fitness trackers and wearables provide heart rate data as an array of values sampled at approximately 1 Hz (one sample per second). We convert this into timestamped pairs:
timestamp = start_time + (index × sampling_interval)
hr_point = [timestamp, heart_rate_value]
Calculating Overall Statistics
Before phase detection, we calculate baseline statistics across the entire session:
mean_hr = average(all_hr_values)
min_hr = minimum(all_hr_values)
max_hr = maximum(all_hr_values)
hr_range = max_hr - min_hr
These statistics allow us to normalize heart rate values relative to each individual's session, accounting for different fitness levels and practice intensities.
Step 2: Calculating Phase Characteristics
For each point in the heart rate data, we calculate three key characteristics that help identify the phase:
1. Heart Rate Level
Normalized heart rate position within the session's range (0-1 scale):
hr_level = (current_hr - min_hr) / hr_range
Where 0 represents the lowest heart rate in the session and 1 represents the highest. This normalized value allows us to compare heart rate intensity across different sessions and individuals.
2. Heart Rate Slope
The rate of change in heart rate, measured in BPM per minute. We use a 60-second moving window and linear regression to calculate the slope:
window = [timestamp - 30s, timestamp + 30s]
slope = linear_regression(hr_values in window)
slope_per_minute = slope × (60 / sampling_interval)
Positive slopes indicate increasing heart rate (warming up, active flow), while negative slopes indicate decreasing heart rate (cooling down, savasana). Near-zero slopes indicate stable heart rate (long holds).
3. Heart Rate Smoothness
A measure of heart rate variability, normalized to a 0-1 scale where 1 is very smooth (low variability) and 0 is very variable:
window = [timestamp - 15s, timestamp + 15s]
std_dev = standard_deviation(hr_values in window)
smoothness = max(0, 1 - (std_dev / 10.0))
High smoothness (low variability) indicates stable, held poses. Low smoothness (high variability) indicates dynamic movement. We use a 30-second window and normalize against a maximum expected standard deviation of 10 BPM.
Step 3: Phase Classification
Using the three characteristics (HR level, slope, and smoothness) plus position in the session, we classify each point into one of the four phases:
Classification Rules
| Phase | Position | HR Level | Slope | Smoothness |
|---|---|---|---|---|
| Warm-up / Settling | < 15% | < 0.4 | > 0.5 BPM/min | Moderate |
| Active Flow | Any | > 0.4 | Variable | < 0.6 |
| Long Holds / Floor Work | Any | 0.3 - 0.7 | |slope| < 1.0 | > 0.7 |
| Cool-down / Savasana | > 85% | Any | < -0.5 BPM/min | > 0.6 |
Default Classification
If a point doesn't match any specific phase criteria, we use position-based defaults:
- First 20% of session: Warm-up / Settling
- Last 20% of session: Cool-down / Savasana
- High smoothness (> 0.65): Long Holds / Floor Work
- Otherwise: Active Flow
Step 4: Calculating Phase Statistics
Once each point is classified, we calculate time and percentage statistics for each phase:
total_time = number_of_points × sampling_interval
phase_seconds = count(points in phase) × sampling_interval
phase_percent = (phase_seconds / total_time) × 100
This gives us both absolute time spent in each phase (in seconds) and relative distribution (as a percentage of total session time).
Key Algorithm Details
Linear Regression for Slope
To calculate heart rate slope, we use linear regression on a 60-second window around each point:
slope = (n × Σ(xy) - Σ(x) × Σ(y)) / (n × Σ(x²) - (Σ(x))²)
where x = time indices, y = heart rate values, n = window size
Standard Deviation for Smoothness
Heart rate smoothness is calculated using standard deviation over a 30-second window:
mean = Σ(hr_values) / n
variance = Σ((hr - mean)²) / n
std_dev = √variance
smoothness = max(0, 1 - (std_dev / 10.0))
The normalization factor of 10 BPM represents a reasonable maximum expected standard deviation for yoga sessions. Standard deviations above this threshold result in smoothness values approaching 0.
Limitations and Considerations
While our phase detection algorithm is sophisticated, there are some limitations:
- Heart rate data required: All analysis depends on having continuous heart rate data throughout the session
- Minimum duration: Sessions need at least 10 heart rate data points to be analyzed
- Practice style variations: Very gentle or very intense practices may not fit neatly into the four-phase model
- Transition periods: Brief transitions between phases may be classified based on default rules rather than specific characteristics
- Individual differences: Heart rate patterns vary significantly between individuals, which is why we normalize relative to each session
Conclusion
By analyzing heart rate level, slope, and smoothness throughout a yoga session, Lasso automatically identifies the distinct phases of your practice. This phase analysis provides valuable insights into the structure and intensity of your sessions, helping you understand how you're spending your time on the mat—whether in dynamic flow, held poses, or restorative relaxation.
The combination of normalized heart rate metrics and position-based classification creates a robust system for understanding yoga practice patterns that goes beyond simple duration and average heart rate.