mirror of
https://github.com/Hestia-Homes/ML.git
synced 2026-06-08 11:17:25 +00:00
Compare commits
3 commits
master
...
carbon@v0.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5aaebd7f44 | ||
|
|
680e879503 | ||
|
|
f4e91162ec |
5 changed files with 40 additions and 33 deletions
|
|
@ -13,6 +13,6 @@ default:
|
||||||
output_filepath: ./data/model/allmodels/
|
output_filepath: ./data/model/allmodels/
|
||||||
problem_type: regression
|
problem_type: regression
|
||||||
eval_metric: mean_squared_error #mean_absolute_error
|
eval_metric: mean_squared_error #mean_absolute_error
|
||||||
time_limit: 4000
|
time_limit: 400
|
||||||
presets: medium_quality
|
presets: medium_quality
|
||||||
excluded_model_types: ['KNN', 'RF']
|
excluded_model_types: ['KNN', 'RF']
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,11 @@ def remove_starting_columns(df):
|
||||||
return df
|
return df
|
||||||
|
|
||||||
|
|
||||||
|
def keep_negative_carbon_change(df):
|
||||||
|
df = df[df["CARBON_CHANGE"] < 0]
|
||||||
|
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()
|
||||||
|
|
@ -27,6 +32,7 @@ def remove_starting_columns(df):
|
||||||
# return df
|
# return df
|
||||||
|
|
||||||
business_logic = {
|
business_logic = {
|
||||||
|
"keep_negative_carbon_change": keep_negative_carbon_change
|
||||||
# "remove_starting_columns": remove_starting_columns
|
# "remove_starting_columns": remove_starting_columns
|
||||||
# "keep_ENDING_COLUMNS": keep_ending_columns
|
# "keep_ENDING_COLUMNS": keep_ending_columns
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,18 @@ import pandas as pd
|
||||||
|
|
||||||
|
|
||||||
def clip_predictions_to_minimum_value(
|
def clip_predictions_to_minimum_value(
|
||||||
data: pd.DataFrame, predictions: pd.Series, minimum_value: int = 1
|
data: pd.DataFrame,
|
||||||
|
predictions: pd.Series,
|
||||||
) -> pd.Series:
|
) -> pd.Series:
|
||||||
|
|
||||||
series_name = predictions.name
|
series_name = predictions.name
|
||||||
predictions.name = "predictions"
|
predictions.name = "predictions"
|
||||||
predictions_df = pd.concat([data, predictions], axis=1)
|
predictions_df = pd.concat([data, predictions], axis=1)
|
||||||
# We expect all prediction to be atleast one point improvement
|
# We expect all prediction to be atleast one point improvement
|
||||||
replace_index = predictions_df["SAP_STARTING"] + 1 > predictions_df["predictions"]
|
replace_index = predictions_df["predictions"] > predictions_df["CARBON_STARTING"]
|
||||||
predictions_df.loc[replace_index, "predictions"] = (
|
predictions_df.loc[replace_index, "predictions"] = predictions_df.loc[
|
||||||
predictions_df.loc[replace_index, "SAP_STARTING"] + minimum_value
|
replace_index, "CARBON_STARTING"
|
||||||
)
|
]
|
||||||
|
|
||||||
predictions_new = predictions_df["predictions"]
|
predictions_new = predictions_df["predictions"]
|
||||||
predictions_new.name = series_name
|
predictions_new.name = series_name
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,9 @@ default:
|
||||||
feature_processor_config:
|
feature_processor_config:
|
||||||
subsample_amount: null
|
subsample_amount: null
|
||||||
subsample_seed: 0
|
subsample_seed: 0
|
||||||
target: SAP_ENDING
|
target: CARBON_ENDING
|
||||||
identifier_columns: ["UPRN"]
|
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: ["SAP_STARTING", "TOTAL_FLOOR_AREA_DIFF"]
|
||||||
retain_features: null
|
retain_features: null
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,11 @@ stages:
|
||||||
- CARBON_CHANGE
|
- CARBON_CHANGE
|
||||||
- RDSAP_CHANGE
|
- RDSAP_CHANGE
|
||||||
- HEAT_DEMAND_ENDING
|
- HEAT_DEMAND_ENDING
|
||||||
- CARBON_ENDING
|
- SAP_ENDING
|
||||||
default.feature_processor.feature_processor_config.retain_features:
|
default.feature_processor.feature_processor_config.retain_features:
|
||||||
default.feature_processor.feature_processor_config.subsample_amount:
|
default.feature_processor.feature_processor_config.subsample_amount:
|
||||||
default.feature_processor.feature_processor_config.subsample_seed: 0
|
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.feature_processor.feature_processor_type: dataframe
|
||||||
default.prepare_data.data_filepath: s3://retrofit-data-dev/sap_change_model/dataset.parquet
|
default.prepare_data.data_filepath: s3://retrofit-data-dev/sap_change_model/dataset.parquet
|
||||||
default.prepare_data.input_dataclient_type: aws-s3
|
default.prepare_data.input_dataclient_type: aws-s3
|
||||||
|
|
@ -29,8 +29,8 @@ stages:
|
||||||
outs:
|
outs:
|
||||||
- path: data/prepared_data/
|
- path: data/prepared_data/
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 9ce5c45722da7fc40491b5a4d00daf9e.dir
|
md5: 5fd3c01804ee2994ee77fc501d178be4.dir
|
||||||
size: 33881619
|
size: 30137355
|
||||||
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: 5359
|
size: 5359
|
||||||
- path: data/prepared_data
|
- path: data/prepared_data
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 9ce5c45722da7fc40491b5a4d00daf9e.dir
|
md5: 5fd3c01804ee2994ee77fc501d178be4.dir
|
||||||
size: 33881619
|
size: 30137355
|
||||||
nfiles: 2
|
nfiles: 2
|
||||||
params:
|
params:
|
||||||
configs/build_model.yaml:
|
configs/build_model.yaml:
|
||||||
|
|
@ -58,7 +58,7 @@ stages:
|
||||||
output_filepath: ./data/model/allmodels/
|
output_filepath: ./data/model/allmodels/
|
||||||
problem_type: regression
|
problem_type: regression
|
||||||
eval_metric: mean_squared_error
|
eval_metric: mean_squared_error
|
||||||
time_limit: 4000
|
time_limit: 400
|
||||||
presets: medium_quality
|
presets: medium_quality
|
||||||
excluded_model_types:
|
excluded_model_types:
|
||||||
- KNN
|
- KNN
|
||||||
|
|
@ -66,13 +66,13 @@ stages:
|
||||||
outs:
|
outs:
|
||||||
- path: data/model/
|
- path: data/model/
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 7bb5156243b4db39349e80a01ffecde4.dir
|
md5: 4b49c12395a645e35e50a9de8840f08d.dir
|
||||||
size: 473398662
|
size: 282024140
|
||||||
nfiles: 27
|
nfiles: 24
|
||||||
- path: metrics/fit_metrics.json
|
- path: metrics/fit_metrics.json
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 2bb16ac67de8778fbc08171d562b34d5
|
md5: a6d139fa59f5ddf75023bb7d3364f6d2
|
||||||
size: 184
|
size: 225
|
||||||
generate_predictions:
|
generate_predictions:
|
||||||
cmd: python 3_generate_predictions.py
|
cmd: python 3_generate_predictions.py
|
||||||
deps:
|
deps:
|
||||||
|
|
@ -82,13 +82,13 @@ stages:
|
||||||
size: 3028
|
size: 3028
|
||||||
- path: data/model
|
- path: data/model
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 7bb5156243b4db39349e80a01ffecde4.dir
|
md5: 4b49c12395a645e35e50a9de8840f08d.dir
|
||||||
size: 473398662
|
size: 282024140
|
||||||
nfiles: 27
|
nfiles: 24
|
||||||
- path: data/prepared_data
|
- path: data/prepared_data
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 9ce5c45722da7fc40491b5a4d00daf9e.dir
|
md5: 5fd3c01804ee2994ee77fc501d178be4.dir
|
||||||
size: 33881619
|
size: 30137355
|
||||||
nfiles: 2
|
nfiles: 2
|
||||||
params:
|
params:
|
||||||
configs/settings.yaml:
|
configs/settings.yaml:
|
||||||
|
|
@ -100,8 +100,8 @@ stages:
|
||||||
outs:
|
outs:
|
||||||
- path: data/predictions/
|
- path: data/predictions/
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 0bb3cf991906953def81c8204cdcfaf0.dir
|
md5: 8f724261b3d17bf87067e91a1ff99077.dir
|
||||||
size: 374532
|
size: 441423
|
||||||
nfiles: 1
|
nfiles: 1
|
||||||
generate_metrics:
|
generate_metrics:
|
||||||
cmd: python 4_generate_metrics.py
|
cmd: python 4_generate_metrics.py
|
||||||
|
|
@ -112,13 +112,13 @@ stages:
|
||||||
size: 4487
|
size: 4487
|
||||||
- path: data/predictions
|
- path: data/predictions
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 0bb3cf991906953def81c8204cdcfaf0.dir
|
md5: 8f724261b3d17bf87067e91a1ff99077.dir
|
||||||
size: 374532
|
size: 441423
|
||||||
nfiles: 1
|
nfiles: 1
|
||||||
- path: data/prepared_data
|
- path: data/prepared_data
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 9ce5c45722da7fc40491b5a4d00daf9e.dir
|
md5: 5fd3c01804ee2994ee77fc501d178be4.dir
|
||||||
size: 33881619
|
size: 30137355
|
||||||
nfiles: 2
|
nfiles: 2
|
||||||
params:
|
params:
|
||||||
configs/settings.yaml:
|
configs/settings.yaml:
|
||||||
|
|
@ -128,8 +128,8 @@ stages:
|
||||||
outs:
|
outs:
|
||||||
- path: metrics/metrics.json
|
- path: metrics/metrics.json
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 2e13ae67759a64261d03224f1c0d4bf4
|
md5: 38787835f838f65c6cc75654843eb311
|
||||||
size: 185
|
size: 223
|
||||||
startup_cleanup:
|
startup_cleanup:
|
||||||
cmd: python 0_startup_cleanup.py
|
cmd: python 0_startup_cleanup.py
|
||||||
deps:
|
deps:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue