Score the full model against the base model; compile the search step
Validation: the walk-forward evaluator now replays all zones together with the full model (electrical heat, neighbour exchange, ventilation and recovery) using the parameters frozen at the forecast start and the electrical heat and window openings that actually happened, and scores the base 3-parameter model on the same spans. Forecast Error sensors add base_model_mae and improvement_vs_base (share of the base model's error the new features remove; 0 = no gain, negative = worse). Saved 0.3 statistics load with their own error as the base column. On synthetic apartments, 60-minute error full vs base: gaming office 0.031 vs 0.182 °C (83 % better), bedroom with ventilation 0.026 vs 0.218 °C (88 %), two coupled rooms 0.024 vs 0.037 °C (34 %; gone by 120 min, where the constant-outdoor assumption dominates). The same ventilation week without window sensors shows no improvement, as it should. These check the method, not real-world accuracy. Performance: every term of a zone's 5-minute change is affine in the zone temperatures and the radiator lag, and which layer applies depends only on which inputs exist. compile_step_model reads the coefficients off the real model per zone and step, so the plan search does a few multiply-adds per step. It matches the direct model to 1e-12 and makes a 180-minute, 5-zone search 4.5x faster (0.73 s here, close to the old base-only search). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8d197fabcd
commit
b1577a0c78
7 files changed
+266
-31
No files matched your search
@@ -784,6 +784,10 @@ class BoundaryTests(unittest.IsolatedAsyncioTestCase):
|
||||
self.assertEqual(details['model_in_use'], 'extended')
|
||||
self.assertGreater(details['contributions_c_per_h']['internal'], 0.2)
|
||||
self.assertTrue(details['coefficients']['extended']['internal']['identified'])
|
||||
# Replayed against what happened, the electrical term removes most of the base error.
|
||||
accuracy = data['forecast_accuracy'][60]
|
||||
self.assertLess(accuracy['mae'], 0.06)
|
||||
self.assertGreater(accuracy['improvement_vs_base'], 0.6)
|
||||
|
||||
async def test_unknown_power_pauses_extended_learning_only(self):
|
||||
self.office_with_ups()
|
||||
@@ -942,6 +946,11 @@ class BoundaryTests(unittest.IsolatedAsyncioTestCase):
|
||||
mixed = without.learners['bed'].theta
|
||||
self.assertLess(mixed[2], -0.008)
|
||||
self.assertGreater(mixed[1], 1.05 * b)
|
||||
# Forecasts replayed with the actual window history are far better than the base model's.
|
||||
configured = with_window._evaluator.summary(with_window.rooms)[60]
|
||||
self.assertGreater(configured['improvement_vs_base'], 0.6)
|
||||
self.assertLess(configured['mae'], 0.06)
|
||||
self.assertEqual(without._evaluator.summary(without.rooms)[60]['improvement_vs_base'], 0)
|
||||
|
||||
async def test_forecast_assumes_window_closes_then_room_recovers(self):
|
||||
self.c = self.bedroom_with_window()
|
||||
@@ -1016,6 +1025,8 @@ class BoundaryTests(unittest.IsolatedAsyncioTestCase):
|
||||
# ...but a steady difference between rooms is collinear with each room's
|
||||
# bias, so the split stays uncertain and is not reported as identified.
|
||||
self.assertFalse(info['identified'])
|
||||
# Joint multi-zone forecasts still beat the base model at an hour.
|
||||
self.assertGreater(c._evaluator.summary(c.rooms)[60]['improvement_vs_base'], 0.15)
|
||||
|
||||
async def test_inter_zone_transfer_stays_near_zero_when_absent(self):
|
||||
c = await self.coupled_rooms(0.0, bed=(0.004, 0.11, 0.0))
|
||||
|
||||
Reference in new issue
Block a user