fix(loadmodel): bound the heating estimate by the house's own use - #1495
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
frahlg
force-pushed
the
1491-heating-bound
branch
from
October 1, 2026 17:52
742b3d0 to
91ca941
Compare
frahlg
force-pushed
the
1491-heating-bound
branch
from
October 1, 2026 18:11
91ca941 to
0924a23
Compare
A heating coefficient set too high could not come down. The fit that moves it runs only in an hour of the week with eight trained days, and an hour trains only when the heating estimate is at or below the measured load. On the home box, 300 W/°C against a 400 W night load at 10 °C put the plan's night load about 2 kW too high, and the night hours never trained. Heating is part of the house's load, so over a day's cold samples coef × Σ(18 °C − T) ≤ Σ load. Each local day with at least six hours of samples below 15 °C yields that bound. Once the last three such days all put the coefficient above their bound, it moves halfway toward the highest of them, so one day with a wood stove or the heating off cannot pull a correct coefficient down. The bound needs no trained hours and never raises the coefficient. The model saves the day's sums and the last three bounds in new fields. State saved before this change loads with empty sums, and the feature hash stays the same, so no site loses what it has learned. Refs #1491 Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
frahlg
force-pushed
the
1491-heating-bound
branch
from
October 1, 2026 18:29
0924a23 to
695e9ec
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The legacy load twin cannot lower a heating coefficient that is set too high:
Updateskips an hour's base sample whenever the heating estimate exceeds the measured load.So an overstated coefficient never trains the hours it overstates, and never comes down. The home box had
weather.heating_w_per_degc: 300: about 2.4 kW of assumed heat at 10 °C against a measured night load of 0.35–0.45 kW. The plan's night load was about 2 kW too high every night. (That setting is now removed on the box.)Change
Heating is part of the house's load, so over a day's cold samples
coef × Σ(18 °C − T) ≤ Σ load.Three days, not one: a single day with a wood stove or the heating off has a low bound, and would otherwise halve a correct coefficient. Only the slow fit would raise it again.
Results (simulated, one sample a minute)
What this does not fix
Night hours still do not train in a house whose night load is below its daily average. The bound settles near the day's mean load ÷ mean ΔT, so the heating estimate stays above the night load and those buckets keep their prior. A day-shaped house without electric heating (mean 1,209 W, 300 W at night, 10 °C) improves from 2,750 to about 1,560 W too high at 02:00, but not to zero. #1491 stays open for that. Options for the owner:
Tests
TestHeatingBoundLowersAnOverstatedPrior: the home box case steps at Thu, Fri and Sat midnight.TestHeatingBoundKeepsRealHeating,TestHeatingBoundIgnoresOneUnusualDay,TestHeatingBoundIgnoresMildDays,TestHeatingBoundNeedsSixColdHours.TestHeatingBoundSumsSurviveRestart,TestStateWithoutHeatingBoundStillLoads;TestFeatureHashPinnedunchanged.make verifyclean.Refs #1491. One of four forecast fixes found while evaluating #1482, with #1492, #1493 and #1494. It shares no files with them. No forecast policy bump: #1494 already starts a new evaluation cohort in the same release.
🤖 Generated with Claude Code