fixing bug where all weights are 0, due to no house numbers

This commit is contained in:
Khalim Conn-Kowlessar 2024-01-03 10:46:22 +00:00
parent 014f684de3
commit 0ec7afccd9
2 changed files with 4 additions and 0 deletions

View file

@ -456,6 +456,9 @@ class SearchEpc:
epc_data["weight"] = 1 / (epc_data["house_number_distance"] + 1)
# If we have a home without a house number, fill that weight with average
epc_data["weight"] = epc_data["weight"].fillna(epc_data["weight"].mean())
# Finally, we might not have any house numbers whatsoever so everything could be
# missing, so we fill with 1
epc_data["weight"] = epc_data["weight"].fillna(1)
epc_built_form = self._estimate_str(key="built-form", estimation_data=epc_data)
epc_property_type = self._estimate_str(key="property-type", estimation_data=epc_data)

View file

@ -137,6 +137,7 @@ def app():
# Get aggregate performance figures
results_df = pd.DataFrame(results)
results_df["tenure"] = results_df["tenure"].replace("Rented (social)", "rental (social)")
avg_numeric_succes = results_df["numeric_success"].median()
avg_categorical_sucess = results_df["categorical_success"].median()