mirror of
https://github.com/Hestia-Homes/ML.git
synced 2026-07-12 13:28:58 +00:00
Merge pull request #87 from Hestia-Homes/heat-dev-model
add restriction to datast
This commit is contained in:
commit
d2a9606fae
2 changed files with 55 additions and 20 deletions
|
|
@ -23,6 +23,37 @@ def keep_negative_heat_change(df):
|
||||||
return df
|
return df
|
||||||
|
|
||||||
|
|
||||||
|
def keep_negative_carbon_change(df):
|
||||||
|
df = df[df["CARBON_CHANGE"] < 0]
|
||||||
|
return df
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: Move to ETL pipeline
|
||||||
|
def remove_unreasonable_habitable_rooms(df):
|
||||||
|
"""
|
||||||
|
Assumption is that proportion of floor area to habitable rooms should be at least 6.5m2
|
||||||
|
"""
|
||||||
|
minimum_room_size_index = (
|
||||||
|
df["TOTAL_FLOOR_AREA_ENDING"] / df["NUMBER_HABITABLE_ROOMS"] >= 6.5
|
||||||
|
)
|
||||||
|
df = df[minimum_room_size_index]
|
||||||
|
return df
|
||||||
|
|
||||||
|
|
||||||
|
def remove_top_1_percent_heat_demand(df):
|
||||||
|
# threshold_value = df.describe(percentiles=[0.99])['HEAT_DEMAND_STARTING']['99%']
|
||||||
|
threshold_value = 860
|
||||||
|
df = df[df["HEAT_DEMAND_STARTING"] < threshold_value]
|
||||||
|
return df
|
||||||
|
|
||||||
|
|
||||||
|
def remove_top_1_percent_carbon(df):
|
||||||
|
# threshold_value = df.describe(percentiles=[0.99])['CARBON_STARTING']['99%']
|
||||||
|
threshold_value = 18
|
||||||
|
df = df[df["CARBON_STARTING"] < threshold_value]
|
||||||
|
return df
|
||||||
|
|
||||||
|
|
||||||
# def keep_ending_columns(df):
|
# def keep_ending_columns(df):
|
||||||
# ending_column_index = [ col_name.endswith("_ENDING") for col_name in list(df.columns)]
|
# ending_column_index = [ col_name.endswith("_ENDING") for col_name in list(df.columns)]
|
||||||
# keep_columns = df.columns[ending_column_index].to_list()
|
# keep_columns = df.columns[ending_column_index].to_list()
|
||||||
|
|
@ -32,7 +63,11 @@ def keep_negative_heat_change(df):
|
||||||
# return df
|
# return df
|
||||||
|
|
||||||
business_logic = {
|
business_logic = {
|
||||||
"keep_negative_heat_change": keep_negative_heat_change
|
"remove_unreasonable_habitable_rooms": remove_unreasonable_habitable_rooms,
|
||||||
|
"keep_negative_heat_change": keep_negative_heat_change,
|
||||||
|
"keep_negative_carbon_change": keep_negative_carbon_change,
|
||||||
|
"remove_top_1_percent_heat_demand": remove_top_1_percent_heat_demand,
|
||||||
|
"remove_top_1_percent_carbon": remove_top_1_percent_carbon,
|
||||||
# "remove_starting_columns": remove_starting_columns
|
# "remove_starting_columns": remove_starting_columns
|
||||||
# "keep_ENDING_COLUMNS": keep_ending_columns
|
# "keep_ENDING_COLUMNS": keep_ending_columns
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ stages:
|
||||||
outs:
|
outs:
|
||||||
- path: data/prepared_data/
|
- path: data/prepared_data/
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 6f9c63363ad52a836524dbb6fae7a2ac.dir
|
md5: f235f38714fefcf6e4927ae95ba912c3.dir
|
||||||
size: 34480114
|
size: 30774760
|
||||||
nfiles: 2
|
nfiles: 2
|
||||||
build_model:
|
build_model:
|
||||||
cmd: python 2_build_model.py
|
cmd: python 2_build_model.py
|
||||||
|
|
@ -41,8 +41,8 @@ stages:
|
||||||
size: 4149
|
size: 4149
|
||||||
- path: data/prepared_data
|
- path: data/prepared_data
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 6f9c63363ad52a836524dbb6fae7a2ac.dir
|
md5: f235f38714fefcf6e4927ae95ba912c3.dir
|
||||||
size: 34480114
|
size: 30774760
|
||||||
nfiles: 2
|
nfiles: 2
|
||||||
params:
|
params:
|
||||||
configs/build_model.yaml:
|
configs/build_model.yaml:
|
||||||
|
|
@ -68,13 +68,13 @@ stages:
|
||||||
outs:
|
outs:
|
||||||
- path: data/model/
|
- path: data/model/
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 452eba2d92233e81d321814aacefe5c2.dir
|
md5: a868845999b46e0272dc27f5cb5bc618.dir
|
||||||
size: 323127043
|
size: 310555147
|
||||||
nfiles: 24
|
nfiles: 24
|
||||||
- path: metrics/fit_metrics.json
|
- path: metrics/fit_metrics.json
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 888124b56e0c5008a6423e290fc5cc71
|
md5: 809f27735c77cbcb62866b96018eedea
|
||||||
size: 222
|
size: 216
|
||||||
generate_predictions:
|
generate_predictions:
|
||||||
cmd: python 3_generate_predictions.py
|
cmd: python 3_generate_predictions.py
|
||||||
deps:
|
deps:
|
||||||
|
|
@ -84,13 +84,13 @@ stages:
|
||||||
size: 2464
|
size: 2464
|
||||||
- path: data/model
|
- path: data/model
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 452eba2d92233e81d321814aacefe5c2.dir
|
md5: a868845999b46e0272dc27f5cb5bc618.dir
|
||||||
size: 323127043
|
size: 310555147
|
||||||
nfiles: 24
|
nfiles: 24
|
||||||
- path: data/prepared_data
|
- path: data/prepared_data
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 6f9c63363ad52a836524dbb6fae7a2ac.dir
|
md5: f235f38714fefcf6e4927ae95ba912c3.dir
|
||||||
size: 34480114
|
size: 30774760
|
||||||
nfiles: 2
|
nfiles: 2
|
||||||
params:
|
params:
|
||||||
configs/settings.yaml:
|
configs/settings.yaml:
|
||||||
|
|
@ -102,8 +102,8 @@ stages:
|
||||||
outs:
|
outs:
|
||||||
- path: data/predictions/
|
- path: data/predictions/
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: f852550a0a51f0c2b120b0680c1a9b54.dir
|
md5: 2098fe82304751025e427f2cc241a2ff.dir
|
||||||
size: 325890
|
size: 295849
|
||||||
nfiles: 1
|
nfiles: 1
|
||||||
generate_metrics:
|
generate_metrics:
|
||||||
cmd: python 4_generate_metrics.py
|
cmd: python 4_generate_metrics.py
|
||||||
|
|
@ -114,13 +114,13 @@ stages:
|
||||||
size: 3448
|
size: 3448
|
||||||
- path: data/predictions
|
- path: data/predictions
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: f852550a0a51f0c2b120b0680c1a9b54.dir
|
md5: 2098fe82304751025e427f2cc241a2ff.dir
|
||||||
size: 325890
|
size: 295849
|
||||||
nfiles: 1
|
nfiles: 1
|
||||||
- path: data/prepared_data
|
- path: data/prepared_data
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 6f9c63363ad52a836524dbb6fae7a2ac.dir
|
md5: f235f38714fefcf6e4927ae95ba912c3.dir
|
||||||
size: 34480114
|
size: 30774760
|
||||||
nfiles: 2
|
nfiles: 2
|
||||||
params:
|
params:
|
||||||
configs/settings.yaml:
|
configs/settings.yaml:
|
||||||
|
|
@ -130,7 +130,7 @@ stages:
|
||||||
outs:
|
outs:
|
||||||
- path: metrics/metrics.json
|
- path: metrics/metrics.json
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: ed3012943593fac4ac7ad9a5499ac18f
|
md5: aa671878e1bd8c6a8d4b5f9788c817c4
|
||||||
size: 219
|
size: 219
|
||||||
startup_cleanup:
|
startup_cleanup:
|
||||||
cmd: python 0_startup_cleanup.py
|
cmd: python 0_startup_cleanup.py
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue