Skip to content

fix(ml): circular sleep std, HRV battery fallback, running economy thresholds, stress 75/25 blend#201

Merged
gerfru merged 1 commit into
mainfrom
wave-17-ml-fixes
Jun 13, 2026
Merged

fix(ml): circular sleep std, HRV battery fallback, running economy thresholds, stress 75/25 blend#201
gerfru merged 1 commit into
mainfrom
wave-17-ml-fixes

Conversation

@gerfru

@gerfru gerfru commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Sleep consistency: replace linear σ with circular Rayleigh R — eliminates midnight-wrap artifact (23:30 vs 00:30 was appearing as 23 h spread instead of 1 h)
  • Body battery: HRV fallback now uses sleep_quality instead of fixed 0.5, removing the artificial [52.5, 88] score cap when no HRV data is available
  • Running economy: unify GCT/VO/VR thresholds with the activity page UI (240 ms / 80 mm / 8 %) — they were inconsistent
  • Stress score blend: rebalance HRV/Garmin weight to 75/25 (was 60/40); Garmin stress is itself HRV-derived, so over-weighting it double-counts the same signal
  • Tests: circular midnight-wrap regression, stress blend ratio assertion, sleep consistency integration test

Test plan

  • cd ml-service && .venv/bin/pytest tests/test_models.py -v — all new tests pass
  • Sleep consistency score for users with ~midnight bedtime should now reflect actual regularity
  • Body battery score without HRV data should track sleep quality instead of being capped at mid-range

🤖 Generated with Claude Code

…resholds, stress 75/25 blend

- Sleep consistency: replace linear std with circular (Rayleigh R) to avoid midnight-wrap artifact
  where 23:30 vs 00:30 would appear as 23h spread instead of 1h
- Body battery: HRV fallback uses sleep_quality instead of fixed 0.5, removing artificial [52.5, 88] cap
- Running economy: unify thresholds with activity.js UI — GCT 240ms, VO 80mm, VR 8%
- Stress score: rebalance HRV/Garmin blend to 75/25 (was 60/40); Garmin stress is HRV-derived
  so over-weighting it would double-count the same signal
- Tests: circular midnight-wrap, stress blend ratio, sleep consistency integration

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gerfru gerfru merged commit 767791e into main Jun 13, 2026
13 checks passed
@gerfru gerfru deleted the wave-17-ml-fixes branch June 13, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant