Compare commits

...

3 commits

Author SHA1 Message Date
quandanrepo
5aaebd7f44
Merge pull request #71 from Hestia-Homes/carbon-dev-model
400 second model
2023-10-11 16:47:13 +01:00
Michael Duong
680e879503 400 second model 2023-10-11 15:38:55 +00:00
Michael Duong
f4e91162ec initial model 2023-10-11 13:23:54 +00:00
5 changed files with 40 additions and 33 deletions

View file

@ -13,6 +13,6 @@ default:
output_filepath: ./data/model/allmodels/
problem_type: regression
eval_metric: mean_squared_error #mean_absolute_error
time_limit: 4000
time_limit: 400
presets: medium_quality
excluded_model_types: ['KNN', 'RF']

View file

@ -18,6 +18,11 @@ def remove_starting_columns(df):
return df
def keep_negative_carbon_change(df):
df = df[df["CARBON_CHANGE"] < 0]
return df
# def keep_ending_columns(df):
# ending_column_index = [ col_name.endswith("_ENDING") for col_name in list(df.columns)]
# keep_columns = df.columns[ending_column_index].to_list()
@ -27,6 +32,7 @@ def remove_starting_columns(df):
# return df
business_logic = {
"keep_negative_carbon_change": keep_negative_carbon_change
# "remove_starting_columns": remove_starting_columns
# "keep_ENDING_COLUMNS": keep_ending_columns
}

View file

@ -5,17 +5,18 @@ import pandas as pd
def clip_predictions_to_minimum_value(
data: pd.DataFrame, predictions: pd.Series, minimum_value: int = 1
data: pd.DataFrame,
predictions: pd.Series,
) -> pd.Series:
series_name = predictions.name
predictions.name = "predictions"
predictions_df = pd.concat([data, predictions], axis=1)
# We expect all prediction to be atleast one point improvement
replace_index = predictions_df["SAP_STARTING"] + 1 > predictions_df["predictions"]
predictions_df.loc[replace_index, "predictions"] = (
predictions_df.loc[replace_index, "SAP_STARTING"] + minimum_value
)
replace_index = predictions_df["predictions"] > predictions_df["CARBON_STARTING"]
predictions_df.loc[replace_index, "predictions"] = predictions_df.loc[
replace_index, "CARBON_STARTING"
]
predictions_new = predictions_df["predictions"]
predictions_new.name = series_name

View file

@ -31,9 +31,9 @@ default:
feature_processor_config:
subsample_amount: null
subsample_seed: 0
target: SAP_ENDING
target: CARBON_ENDING
identifier_columns: ["UPRN"]
drop_columns: ["HEAT_DEMAND_CHANGE", "CARBON_CHANGE", "RDSAP_CHANGE", "HEAT_DEMAND_ENDING", "CARBON_ENDING"]
drop_columns: ["HEAT_DEMAND_CHANGE", "CARBON_CHANGE", "RDSAP_CHANGE", "HEAT_DEMAND_ENDING", "SAP_ENDING"]
# retain_features: ["SAP_STARTING", "TOTAL_FLOOR_AREA_DIFF"]
retain_features: null

View file

@ -14,11 +14,11 @@ stages:
- CARBON_CHANGE
- RDSAP_CHANGE
- HEAT_DEMAND_ENDING
- CARBON_ENDING
- SAP_ENDING
default.feature_processor.feature_processor_config.retain_features:
default.feature_processor.feature_processor_config.subsample_amount:
default.feature_processor.feature_processor_config.subsample_seed: 0
default.feature_processor.feature_processor_config.target: SAP_ENDING
default.feature_processor.feature_processor_config.target: CARBON_ENDING
default.feature_processor.feature_processor_type: dataframe
default.prepare_data.data_filepath: s3://retrofit-data-dev/sap_change_model/dataset.parquet
default.prepare_data.input_dataclient_type: aws-s3
@ -29,8 +29,8 @@ stages:
outs:
- path: data/prepared_data/
hash: md5
md5: 9ce5c45722da7fc40491b5a4d00daf9e.dir
size: 33881619
md5: 5fd3c01804ee2994ee77fc501d178be4.dir
size: 30137355
nfiles: 2
build_model:
cmd: python 2_build_model.py
@ -41,8 +41,8 @@ stages:
size: 5359
- path: data/prepared_data
hash: md5
md5: 9ce5c45722da7fc40491b5a4d00daf9e.dir
size: 33881619
md5: 5fd3c01804ee2994ee77fc501d178be4.dir
size: 30137355
nfiles: 2
params:
configs/build_model.yaml:
@ -58,7 +58,7 @@ stages:
output_filepath: ./data/model/allmodels/
problem_type: regression
eval_metric: mean_squared_error
time_limit: 4000
time_limit: 400
presets: medium_quality
excluded_model_types:
- KNN
@ -66,13 +66,13 @@ stages:
outs:
- path: data/model/
hash: md5
md5: 7bb5156243b4db39349e80a01ffecde4.dir
size: 473398662
nfiles: 27
md5: 4b49c12395a645e35e50a9de8840f08d.dir
size: 282024140
nfiles: 24
- path: metrics/fit_metrics.json
hash: md5
md5: 2bb16ac67de8778fbc08171d562b34d5
size: 184
md5: a6d139fa59f5ddf75023bb7d3364f6d2
size: 225
generate_predictions:
cmd: python 3_generate_predictions.py
deps:
@ -82,13 +82,13 @@ stages:
size: 3028
- path: data/model
hash: md5
md5: 7bb5156243b4db39349e80a01ffecde4.dir
size: 473398662
nfiles: 27
md5: 4b49c12395a645e35e50a9de8840f08d.dir
size: 282024140
nfiles: 24
- path: data/prepared_data
hash: md5
md5: 9ce5c45722da7fc40491b5a4d00daf9e.dir
size: 33881619
md5: 5fd3c01804ee2994ee77fc501d178be4.dir
size: 30137355
nfiles: 2
params:
configs/settings.yaml:
@ -100,8 +100,8 @@ stages:
outs:
- path: data/predictions/
hash: md5
md5: 0bb3cf991906953def81c8204cdcfaf0.dir
size: 374532
md5: 8f724261b3d17bf87067e91a1ff99077.dir
size: 441423
nfiles: 1
generate_metrics:
cmd: python 4_generate_metrics.py
@ -112,13 +112,13 @@ stages:
size: 4487
- path: data/predictions
hash: md5
md5: 0bb3cf991906953def81c8204cdcfaf0.dir
size: 374532
md5: 8f724261b3d17bf87067e91a1ff99077.dir
size: 441423
nfiles: 1
- path: data/prepared_data
hash: md5
md5: 9ce5c45722da7fc40491b5a4d00daf9e.dir
size: 33881619
md5: 5fd3c01804ee2994ee77fc501d178be4.dir
size: 30137355
nfiles: 2
params:
configs/settings.yaml:
@ -128,8 +128,8 @@ stages:
outs:
- path: metrics/metrics.json
hash: md5
md5: 2e13ae67759a64261d03224f1c0d4bf4
size: 185
md5: 38787835f838f65c6cc75654843eb311
size: 223
startup_cleanup:
cmd: python 0_startup_cleanup.py
deps: