Skip to content

feat: smooth the weight curve with state_space - #573

Open
gwosd wants to merge 5 commits into
v2from
feat/state-space-smoothing
Open

gwosd wants to merge 5 commits into
v2from
feat/state-space-smoothing

Conversation

@gwosd

@gwosd gwosd commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

The interpolation part of #545 on its own, without any design changes, so it can be reviewed separately. The weight curve now comes from state_space, a smoother of the log weight with a fading trend, week-scale changes, water and the scale error, instead of the Gaussian kernel. It runs in linear time and learns how much each diary scatters.

Changes

  • Curve and slope from state_space; the strengths become slope sds scaled to body weight, "none" takes its rate from medium
  • The day-to-day and week-to-week scatter and the scale error are refitted from the fifth day with readings
  • The cards read the curve's change over 14 days, the forecasts average it with the trend's fading rate; the target threshold is relative to body weight
  • The interpolation cache is removed, since the splash recomputed on every start anyway; the released key is deleted once
  • Fixed: the grid lost its last day when that was read earlier in the day than the first, and with "none" the rate was read from a week earlier
  • state_space comes from its unreleased priors branch (feat: hold parameters, fit under priors, sum chosen components state_space#19); 0.3.0 must be released before v2 ships

The scientific chart and its band, the dashed projection, the growing profile and sharing the summary follow in later PRs.

Closes #481
Closes #279

gwosd added 5 commits October 23, 2026 14:34
The last day was dropped when it was read earlier in the day than the first.
The smoothing needs held parameters, priors and summed components, which are not released yet.
A smoother of the log weight with a fading trend, week-scale changes, water
and the scale error replaces the Gaussian kernel. It runs in linear time, so
the cache goes too: the splash recomputed the curve on every start anyway.
How much a weight varies from day to day and week to week differs between
people and scales. A refit in the background, from the fifth day with
readings, puts each at its posterior mode under priors centred on the typical
values.
The tissue slope fades towards zero, so at the last reading it shows only
about three quarters of a steady loss. The cards read the curve's change over
two weeks, and the forecasts average it with the trend's fading rate.

This branch has not been deployed

No deployments
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