mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
handling missing weight possibilities and 0 weights
This commit is contained in:
parent
81621eb1de
commit
748dc14271
1 changed files with 4 additions and 1 deletions
|
|
@ -450,7 +450,10 @@ class SearchEpc:
|
|||
epc_data["house_number_distance"] = abs(
|
||||
epc_data["numeric_house_number"] - self.numeric_house_number
|
||||
)
|
||||
epc_data["weight"] = 1 / epc_data["house_number_distance"]
|
||||
# We add 1, just in case we have a 0 weight (e.g. comparing house number 7a to 7b, or 9A to 9)
|
||||
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())
|
||||
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue