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
@@ -134,6 +134,17 @@ class Learner:
|
||||
def mae(self) -> float | None:
|
||||
return self.error_sum / self.count if self.count else None
|
||||
|
||||
def confidence(self) -> dict[str, float]:
|
||||
"""Per coefficient, the share of its information that comes from data (0 = prior only).
|
||||
|
||||
Taken from the coefficient's own uncertainty, not from the sample count: it
|
||||
only grows while the data varies that coefficient's input independently of
|
||||
the others. Weeks with the relay always off leave `heat` at 0; a steady
|
||||
indoor-outdoor difference cannot separate `loss` from `bias`.
|
||||
"""
|
||||
return {name: round(1 - min(prior, max(0.0, self.p[i][i])) / prior, 3)
|
||||
for i, (name, prior) in enumerate(zip(("loss", "heat", "bias"), PRIOR_VARIANCE))}
|
||||
|
||||
def as_dict(self) -> dict[str, Any]:
|
||||
return {"theta": self.theta, "p": self.p, "count": self.count, "error_sum": self.error_sum,
|
||||
"on_count": self.on_count, "off_count": self.off_count,
|
||||
|
||||
Reference in new issue
Block a user