investigating secondary glazing recommendations

This commit is contained in:
Khalim Conn-Kowlessar 2024-09-26 08:47:53 +01:00
parent c1b3bc2ece
commit 6a45789edd
4 changed files with 41 additions and 10 deletions

View file

@ -503,11 +503,10 @@ class Property:
output["lighting_energy_eff_ending"] = "Very Good"
if recommendation["type"] == "windows_glazing":
is_secondary_glazing = recommendation["is_secondary_glazing"]
output["multi_glaze_proportion_ending"] = 100
if output["windows_energy_eff_ending"] not in ["Average", "Good", "Very Good"]:
output["windows_energy_eff_ending"] = "Average"
is_secondary_glazing = recommendation["is_secondary_glazing"]
output["windows_energy_eff_ending"] = "Average" if not is_secondary_glazing else "Good"
if output["glazing_type_ending"] == "multiple":
pass

View file

@ -843,14 +843,44 @@ async def trigger_plan(body: PlanTriggerRequest):
training_fixed = training_fixed.reset_index(drop=True)
# Get the recommendation config for this uprn
uprn = 121016121
property_instance = [p for p in input_properties if p.uprn == uprn][0]
property_recs = recommendations[property_instance.id]
window_recs = [r for r in property_recs if r[0]["type"] == "windows_glazing"][0]
window_recs[0].keys()
window_recs[0]["description_simulation"]["multi-glaze-proportion"]
# TODO: - In description_simulation for windows, we update glazed-type but in the model training data there
# is a column called "glazing-type".
# - We don't update glazed-area (should be "Much More Than Typical" most likely? Or Normal??)
# TODO: I think we update eveything that we actually need to, when simulating the recommendation impact for the
# ML models
# TODO: Secondary glazing appears to go to "Good", not "Average". Investigate why
# TODO: For the two properties, force recommendations for double glazing and check impact
z = training_data[training_data["glazed_type_ending"] == "secondary glazing"]
z = z[z["multi_glaze_proportion_ending"] == 100]
z["windows_energy_eff_ending"].value_counts()
# Find the things that change
example = training_fixed.iloc[0]
things_that_change = []
for c in ending_cols:
if example[c] != example[starting[c]]:
things_that_change.append(c)
# 100051011370
example[]
example = training_fixed.iloc[3]
for _, example in training_fixed.iterrows():
things_that_change = []
for c in ending_cols:
if example[c] != example[starting[c]]:
things_that_change.append(c)
if len(things_that_change) > 4:
print(things_that_change)
print(example["uprn"])
# blah
# 100051011370 (doesn't change in actual glazing)
# example["glazed_type_ending"]
# double glazing installed before 2002
# example["glazed_type_starting"]
# double glazing, unknown install date
# 100040925015
# We call the API with the scoring epcs
scoring_epcs = pd.DataFrame(scoring_epcs)

View file

@ -15,6 +15,7 @@ class RoofAttributes(Definitions):
"ar oleddf, wedi?i inswleiddio (rhagdybiaeth)": "pitched, insulated (assumed)",
"ar oleddf, wedigçöi hinswleiddio (rhagdybiaeth)": "pitched, insulated (assumed)",
"ar oleddf, wedigçöi inswleiddio": "pitched, insulated",
"ar oleddf, wedi?i inswleiddio": "pitched, insulated",
"ar oleddf, inswleiddio cyfyngedig (rhagdybiaeth)": "pitched, limited insulation (assumed)",
"ar oleddf, inswleiddio cyfyngedig": "pitched, limited insulation",
"ar oleddf, wedigçöi inswleiddio wrth y trawstiau": 'pitched, insulated at rafters',

View file

@ -27,6 +27,7 @@ class WindowAttributes(Definitions):
"gwydrau triphlyg llawn": "fully triple glazed",
"gwydrau triphlyg rhannol": "partial triple glazed",
"gwydrau triphlyg mwyaf": "mostly triple glazed",
"gwydrau triphlyg gan mwyaf": "mostly triple glazed",
"gwydrau eilaidd llawn": "full secondary glazing",
"gwydrau eilaidd mwyaf": "mostly secondary glazing",
"gwydrau eilaidd rhannol": "partial secondary glazing",