test(accuracy): ratchet SAP gauge after PV connection gate 🟪

within-0.5 floor 0.73->0.74 (now 0.741), MAE ceiling 0.762->0.740 (now
0.7397) on the fixed RdSAP-21.0.1 corpus. Log entry appended.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-06-29 13:43:30 +00:00
parent 8606cab5f0
commit 9927169e23

View file

@ -193,7 +193,7 @@ _CORPUS = Path(
# within-0.5 71.6% -> 72.5%, MAE 0.819 -> 0.815. Surfaced by Khalim's Elmhurst
# stress worksheet (simulated case 46): closed its last ventilation residual
# (our Jan ACH 9.14 -> 9.0748 exact; SAP 29 -> 30 = accredited Elmhurst).
_MIN_WITHIN_HALF_SAP = 0.73
_MIN_WITHIN_HALF_SAP = 0.74
# 0.793 -> 0.789 via the §12 Unknown-meter + dual-electric-immersion off-peak
# trigger (RdSAP 10 PDF p.62): Apartment 241 (main 691 + 903 dual immersion)
# -5.38 -> -1.05. Worksheet-validated on "simulated case 48" (Elmhurst SAP 57,
@ -238,7 +238,17 @@ _MIN_WITHIN_HALF_SAP = 0.73
# already computes 74. roof_insulation_location="ND" ⟺ party ceiling separates
# the corpus classes with zero disagreement (all 190 party flats lodge "ND");
# the 4 mid/ground-floor flats this exposes all move toward lodged, 0 away.
_MAX_SAP_MAE = 0.762
# Then 0.761 -> 0.740 (within-0.5 73.6% -> 74.1%) via the PV dwelling-meter
# connection gate (RdSAP 10 §11.1 / SAP 10.2 Appendix M): PV is credited to the
# dwelling only when gov-API `pv_connection == 2` ("connected to the dwelling's
# meter"); == 1 ("present but NOT connected" — communal / separately metered)
# now contributes zero to cost/CO2/PE. All 5 pv_connection=1 PV certs move
# inside ±0.5 (e.g. 100051118081 +6.5 -> +0.5); pv_connection=2 certs (52) keep
# their credit (corpus MAE 0.98 with vs 10.29 without). Khalim's Elmhurst proof:
# an identical dwelling rates SAP 87 with "Connected to Dwelling = Yes" (credit
# -£167) vs SAP 74 with "No" (credit £0). Enum decoded empirically: 0 = no PV,
# 1 = not connected, 2 = connected (the gov-API does not expose it elsewhere).
_MAX_SAP_MAE = 0.740
_MAX_CO2_MAE_TONNES = 0.09 # t CO2 / yr vs co2_emissions_current
_MAX_PE_PER_M2_MAE = 3.5 # kWh / m2 / yr vs energy_consumption_current