Report how well the base coefficients are identified
The base layer (loss, heat, bias) showed values only, so a zone with weeks of samples looked equally trustworthy whether or not the data ever varied its inputs. Each base coefficient now reports a confidence from its own posterior variance, as the extended and ventilation layers already did: it stays at 0 for `heat` while the relay never cycles and below 0.8 for `loss` and `bias` while the indoor-outdoor difference is steady. Readiness is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
26c415fa6c
commit
a44163a57d
4 files changed
+47
-2
No files matched your search
@@ -140,6 +140,31 @@ class ModelTests(unittest.TestCase):
|
||||
self.assertEqual(restored.count, 30000)
|
||||
self.assertEqual(restored.p, learn.p)
|
||||
|
||||
def test_confidence_reflects_excitation_not_sample_count(self):
|
||||
# Two weeks of samples, relay always off, a steady 15 degC difference to outside.
|
||||
steady = m.Learner()
|
||||
for _ in range(4000):
|
||||
steady.learn(20.0, 20.0 + 0.003 * -15 + 0.001, 5.0, 0.0, command=False)
|
||||
confidence = steady.confidence()
|
||||
self.assertEqual(steady.count, 4000)
|
||||
self.assertEqual(confidence['heat'], 0) # never exercised
|
||||
self.assertLess(confidence['loss'], 0.8) # not separable from bias
|
||||
self.assertLess(confidence['bias'], 0.8)
|
||||
# Fewer samples, with the relay cycling and a cold and a mild spell each day.
|
||||
varied = m.Learner()
|
||||
t, lag = 20.0, 0.0
|
||||
for step in range(1200):
|
||||
heater = int(step % 96 < 35)
|
||||
lag = lag + m.HEAT_LAG * (heater - lag)
|
||||
outside = -2 + 14 * ((step // 144) % 2)
|
||||
value = t + 0.003 * (outside - t) + 0.055 * lag + 0.001
|
||||
varied.learn(t, value, outside, lag, command=bool(heater))
|
||||
t = value
|
||||
self.assertTrue(all(value > 0.8 for value in varied.confidence().values()), varied.confidence())
|
||||
# Recalibration starts confidence over.
|
||||
varied.recalibrate()
|
||||
self.assertEqual(set(varied.confidence().values()), {0})
|
||||
|
||||
def test_restore_tolerates_round_off_and_bounds_wound_up_covariance(self):
|
||||
# Shape of a v0.2.1 model after a summer: huge heat variance, tiny asymmetry.
|
||||
data = m.Learner(count=40000, off_count=40000).as_dict()
|
||||
|
||||
Reference in new issue
Block a user