Skip to content

fix: trend-aware catch-up projection#17

Closed
richhaase wants to merge 1 commit intomainfrom
fix/weighted-rolling-avg
Closed

fix: trend-aware catch-up projection#17
richhaase wants to merge 1 commit intomainfrom
fix/weighted-rolling-avg

Conversation

@richhaase
Copy link
Copy Markdown
Owner

Summary

  • Fixes overly pessimistic catch-up projection that showed "won't catch up" even when recent weeks were above target pace
  • Weighted average: linear weights [1,2,3,4] (oldest→newest) instead of flat average, so recent training matters more
  • Trend-aware simulation: computes weekly volume slope via linear regression; when positive, each projected future week increases by the trend rate
  • Shows trend info in the catch-up callout (e.g. "Volume trending up +3,000 m/wk²")

Before

Won't catch up at recent pace. Your rolling 4-week average of 16,250 m/wk isn't enough to close the gap.

After

Catch-up projection: At your recent pace of 17,750 m/wk, you'll be back on target by Apr 23, 2026 (5 weeks from now). Volume trending up +3,000 m/wk².

Test plan

  • All 61 tests pass
  • Typecheck + biome lint clean
  • Smoke tested: catch-up date now appears with positive trend
  • Verify "on pace" state still works when ahead of target
  • Verify "won't catch up" still shows when trend is flat/negative and avg is below target

🤖 Generated with Claude Code

The flat 4-week average was too conservative when ramping up — older
low-volume weeks dragged the average below target even when recent
weeks were above pace. Now:

- Uses weighted 4-week average (linear weights favoring recent weeks)
- Computes weekly volume trend via linear regression
- Catch-up simulation projects each future week as avg + trend*w
  when trend is positive, so upward trajectories are modeled
- Shows trend rate in the catch-up callout (+X m/wk²)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@richhaase richhaase closed this Mar 25, 2026
@richhaase richhaase deleted the fix/weighted-rolling-avg branch March 29, 2026 19:18
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