Skip to content

Fix/phase detection ema - #68

Merged
PaladinKnightMaster merged 8 commits into
devfrom
fix/phase-detection-ema
Jun 4, 2026
Merged

PaladinKnightMaster merged 8 commits into
devfrom
fix/phase-detection-ema

Conversation

@PaladinKnightMaster

Copy link
Copy Markdown
Owner

Summary

War-room #1 → 🟢. Replace the mathematically-broken Savitzky-Golay smoother with
a correct EMA and re-enable smoothing.

  • New EmaSmoother (src/lib/phaseDetection/ema.ts): seed-first EMA,
    α = 2/(windowSize+1) ≈ 0.33; constant input round-trips exactly, output stays
    in [0,1] (HMM observation means stay valid).
  • HMM detector drives smoothing through EmaSmoother (was RealTimeSavitzkyGolay).
  • Smoothing re-enabled in both validatorIntegration.ts config defaults.
  • Deleted savitzkyGolay.ts (broken coefficient math, −376 lines).
  • Inverted the pinning test: sgDefaultDisabled.test.ts → emaSmoothing.test.ts
    (round-trip correctness instead of bug-existence).

Test Plan

  • npm run test 90/90 · lint clean · build green
  • squat/pushup/plank rep-count tests green with smoothing ON (no α tuning)
  • extended phaseDetection suite green through EMA

PaladinKnightMaster and others added 8 commits June 3, 2026 14:15
)

Correct EMA (alpha=2/(windowSize+1)=0.33), re-enable smoothing in production,
delete broken SG, invert the pinning test. Hard checkpoint: testPoseScripts rep
counts must stay green with EMA on (tune alpha if not).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…#1)

7 tasks, build-safe ordering: EMA module (TDD) -> rewire HMM -> re-enable config
-> replace pinning test -> delete broken SG + fix extended test -> rep-count
hard checkpoint (tune alpha if needed) -> tracker to green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ving)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace RealTimeSavitzkyGolay with EmaSmoother (alpha derived from
windowSize via alphaFromWindow) in constructor and updateConfig
reconstruction site. savitzkyGolay.ts is intentionally left in place
for removal in a later task.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Removes savitzkyGolay.ts (broken coefficient math, war-room #1) and the
SG-specific block + import from the extended phaseDetection test. HMM smoothing
now runs through EmaSmoother. No references remain.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…olay

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ai-form-coach Ready Ready Preview, Comment Jun 4, 2026 12:25pm

@PaladinKnightMaster
PaladinKnightMaster merged commit 301a0c4 into dev Jun 4, 2026
4 checks passed
@PaladinKnightMaster
PaladinKnightMaster deleted the fix/phase-detection-ema branch June 4, 2026 12:32

This branch was successfully deployed

1 active deployment
Preview — eb644cfb Deployed Jun 4, 2026 by vercel[bot]
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