mirror of
https://github.com/Hestia-Homes/ML.git
synced 2026-06-08 11:17:25 +00:00
Compare commits
25 commits
master
...
heat@v0.4.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8dea4c105 | ||
|
|
7d44b82583 | ||
|
|
66ff6e1e22 | ||
|
|
273dcdad31 | ||
|
|
4b81ce9374 | ||
|
|
469f77d8fb | ||
|
|
55da3d0339 | ||
|
|
66f54a92e2 | ||
|
|
ba1971498c | ||
|
|
2cb28616bb | ||
|
|
7554988070 | ||
|
|
9271df34e0 | ||
|
|
7f984e6cbf | ||
|
|
d8d5a66537 | ||
|
|
676539e6a7 | ||
|
|
890ca15193 | ||
|
|
5a9eb608bd | ||
|
|
f4f8dc2bf2 | ||
|
|
2d331736a4 | ||
|
|
7d685caaf5 | ||
|
|
dffb01bf8e | ||
|
|
d2a7615e3b | ||
|
|
4c6c5330d8 | ||
|
|
9e7d0fa538 | ||
|
|
ad2c266727 |
12 changed files with 150 additions and 64 deletions
|
|
@ -8,17 +8,25 @@
|
||||||
"active": true
|
"active": true
|
||||||
},
|
},
|
||||||
"sap": {
|
"sap": {
|
||||||
"version": "v0.1.0",
|
"version": "v0.4.0",
|
||||||
"stage": {
|
"stage": {
|
||||||
"dev": "v0.1.0"
|
"dev": "v0.4.0"
|
||||||
},
|
},
|
||||||
"registered": true,
|
"registered": true,
|
||||||
"active": true
|
"active": true
|
||||||
},
|
},
|
||||||
"heat": {
|
"heat": {
|
||||||
"version": "v0.0.1",
|
"version": "v0.3.0",
|
||||||
"stage": {
|
"stage": {
|
||||||
"dev": "v0.0.1"
|
"dev": "v0.3.0"
|
||||||
|
},
|
||||||
|
"registered": true,
|
||||||
|
"active": true
|
||||||
|
},
|
||||||
|
"carbon": {
|
||||||
|
"version": "v0.3.0",
|
||||||
|
"stage": {
|
||||||
|
"dev": "v0.2.0"
|
||||||
},
|
},
|
||||||
"registered": true,
|
"registered": true,
|
||||||
"active": true
|
"active": true
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,8 @@ def prepare_data(
|
||||||
|
|
||||||
if train_proportion == 1:
|
if train_proportion == 1:
|
||||||
train = data
|
train = data
|
||||||
test = None
|
# Sample 10% of the data for testing
|
||||||
|
test = data.sample(round(len(data) * 0.1))
|
||||||
else:
|
else:
|
||||||
train, test = train_test_split(
|
train, test = train_test_split(
|
||||||
data, train_size=train_proportion, test_size=(1 - train_proportion)
|
data, train_size=train_proportion, test_size=(1 - train_proportion)
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,12 @@ prepare_data_params = settings.prepare_data
|
||||||
build_model_params = settings.build_model
|
build_model_params = settings.build_model
|
||||||
feature_process_params = settings.feature_processor
|
feature_process_params = settings.feature_processor
|
||||||
generate_metrics_params = settings.generate_metrics
|
generate_metrics_params = settings.generate_metrics
|
||||||
|
generate_predictions_params = settings.generate_predictions
|
||||||
|
|
||||||
model_type = build_model_params["model_type"]
|
model_type = build_model_params["model_type"]
|
||||||
target = feature_process_params["feature_processor_config"]["target"]
|
target = feature_process_params["feature_processor_config"]["target"]
|
||||||
|
fit_predictions_filepath = build_model_params["fit_predictions_filepath"]
|
||||||
|
predictions_column_name = generate_predictions_params["predictions_column_name"]
|
||||||
identifier_columns = feature_process_params["feature_processor_config"][
|
identifier_columns = feature_process_params["feature_processor_config"][
|
||||||
"identifier_columns"
|
"identifier_columns"
|
||||||
]
|
]
|
||||||
|
|
@ -60,6 +63,8 @@ def build_model(
|
||||||
identifier_columns: List[str],
|
identifier_columns: List[str],
|
||||||
model_save_location: str,
|
model_save_location: str,
|
||||||
model_hyperparameters: dict,
|
model_hyperparameters: dict,
|
||||||
|
fit_predictions_filepath: str,
|
||||||
|
predictions_column_name: str,
|
||||||
fit_metrics_filepath: str,
|
fit_metrics_filepath: str,
|
||||||
train_filepath: Union[str, None] = None,
|
train_filepath: Union[str, None] = None,
|
||||||
test_filepath: Union[str, None] = None,
|
test_filepath: Union[str, None] = None,
|
||||||
|
|
@ -93,6 +98,15 @@ def build_model(
|
||||||
data=train_data, post_prediction_logic=post_prediction_logic
|
data=train_data, post_prediction_logic=post_prediction_logic
|
||||||
)
|
)
|
||||||
|
|
||||||
|
logger.info("--- Saving fit predictions ---")
|
||||||
|
|
||||||
|
predictions_df = pd.DataFrame(fit_predictions)
|
||||||
|
predictions_df.columns = [predictions_column_name]
|
||||||
|
|
||||||
|
dataclient.save_data(
|
||||||
|
obj=predictions_df, location=fit_predictions_filepath, save_config=None
|
||||||
|
)
|
||||||
|
|
||||||
logger.info("--- Generating fit metrics ---")
|
logger.info("--- Generating fit metrics ---")
|
||||||
|
|
||||||
metrics_output = metrics.generate_metrics(
|
metrics_output = metrics.generate_metrics(
|
||||||
|
|
@ -128,6 +142,8 @@ if __name__ == "__main__":
|
||||||
train_filepath=train_filepath,
|
train_filepath=train_filepath,
|
||||||
test_filepath=test_filepath,
|
test_filepath=test_filepath,
|
||||||
fit_metrics_filepath=fit_metrics_filepath,
|
fit_metrics_filepath=fit_metrics_filepath,
|
||||||
|
fit_predictions_filepath=fit_predictions_filepath,
|
||||||
|
predictions_column_name=predictions_column_name,
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.info(f"--- {__file__} - Complete! ---")
|
logger.info(f"--- {__file__} - Complete! ---")
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,7 @@ After the model is built, we can evaluate its performance
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import yaml
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from pathlib import Path
|
|
||||||
from core.interface.InterfaceModels import MLModel
|
from core.interface.InterfaceModels import MLModel
|
||||||
from core.interface.InterfaceMetrics import MLMetrics
|
from core.interface.InterfaceMetrics import MLMetrics
|
||||||
from core.interface.InterfaceDataClient import DataClient
|
from core.interface.InterfaceDataClient import DataClient
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ default:
|
||||||
model_type: AutogluonAutoML
|
model_type: AutogluonAutoML
|
||||||
model_save_filepath: ./data/model/optimised/
|
model_save_filepath: ./data/model/optimised/
|
||||||
fit_metrics_filepath: ./metrics/fit_metrics.json
|
fit_metrics_filepath: ./metrics/fit_metrics.json
|
||||||
|
fit_predictions_filepath: ./data/fit_predictions/predictions.parquet
|
||||||
|
|
||||||
SKLearnLinearRegression: null
|
SKLearnLinearRegression: null
|
||||||
|
|
||||||
|
|
@ -15,6 +16,6 @@ default:
|
||||||
eval_metric: mean_squared_error #mean_absolute_error
|
eval_metric: mean_squared_error #mean_absolute_error
|
||||||
time_limit: 4000
|
time_limit: 4000
|
||||||
presets: medium_quality
|
presets: medium_quality
|
||||||
excluded_model_types: ['KNN', 'RF']
|
excluded_model_types: ['RF', 'FASTAI', 'CAT', 'NN_TORCH', 'KNN', 'XT']
|
||||||
infer_limit: 0.05
|
infer_limit: 0.05
|
||||||
infer_limit_batch_size: 10000
|
infer_limit_batch_size: 10000
|
||||||
|
|
|
||||||
|
|
@ -9,15 +9,51 @@ Business Logic dict + functions
|
||||||
|
|
||||||
def remove_starting_columns(df):
|
def remove_starting_columns(df):
|
||||||
keep_column_index = [
|
keep_column_index = [
|
||||||
False if col_name.endswith("_STARTING") else True
|
False if col_name.endswith("_starting") else True
|
||||||
for col_name in list(df.columns)
|
for col_name in list(df.columns)
|
||||||
]
|
]
|
||||||
keep_columns = df.columns[keep_column_index].to_list()
|
keep_columns = df.columns[keep_column_index].to_list()
|
||||||
keep_columns.append("SAP_STARTING")
|
keep_columns.append("sap_starting")
|
||||||
df = df[keep_columns]
|
df = df[keep_columns]
|
||||||
return df
|
return df
|
||||||
|
|
||||||
|
|
||||||
|
def keep_negative_heat_change(df):
|
||||||
|
df = df[df["heat_demand_change"] < 0]
|
||||||
|
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()
|
||||||
|
|
@ -27,6 +63,11 @@ def remove_starting_columns(df):
|
||||||
# return df
|
# return df
|
||||||
|
|
||||||
business_logic = {
|
business_logic = {
|
||||||
|
"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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,19 @@ 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, minimum_value: int = 0
|
||||||
) -> 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["heat_demand_starting"] - minimum_value
|
||||||
|
)
|
||||||
predictions_df.loc[replace_index, "predictions"] = (
|
predictions_df.loc[replace_index, "predictions"] = (
|
||||||
predictions_df.loc[replace_index, "SAP_STARTING"] + minimum_value
|
predictions_df.loc[replace_index, "heat_demand_starting"] - minimum_value
|
||||||
)
|
)
|
||||||
|
|
||||||
predictions_new = predictions_df["predictions"]
|
predictions_new = predictions_df["predictions"]
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,9 @@ default:
|
||||||
# data_filepath: s3://retrofit-data-dev/sap_change_model/dataset_with_differencing.parquet
|
# data_filepath: s3://retrofit-data-dev/sap_change_model/dataset_with_differencing.parquet
|
||||||
# data_filepath: s3://retrofit-data-dev/sap_change_model/floor_area_clean_test.parquet
|
# data_filepath: s3://retrofit-data-dev/sap_change_model/floor_area_clean_test.parquet
|
||||||
# data_filepath: s3://retrofit-data-dev/sap_change_model/dataset_without_differencing.parquet
|
# data_filepath: s3://retrofit-data-dev/sap_change_model/dataset_without_differencing.parquet
|
||||||
data_filepath: s3://retrofit-data-dev/sap_change_model/dataset_test.parquet
|
# data_filepath: s3://retrofit-data-dev/sap_change_model/dataset.parquet
|
||||||
train_proportion: 0.9
|
data_filepath: s3://retrofit-datalake-dev/dataset_with0perm_all.parquet
|
||||||
|
train_proportion: 1
|
||||||
output_train_filepath: ./data/prepared_data/train.parquet
|
output_train_filepath: ./data/prepared_data/train.parquet
|
||||||
output_test_filepath: ./data/prepared_data/test.parquet
|
output_test_filepath: ./data/prepared_data/test.parquet
|
||||||
|
|
||||||
|
|
@ -31,9 +32,9 @@ default:
|
||||||
feature_processor_config:
|
feature_processor_config:
|
||||||
subsample_amount: null
|
subsample_amount: null
|
||||||
subsample_seed: 0
|
subsample_seed: 0
|
||||||
target: SAP_ENDING
|
target: heat_demand_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", "sap_ending", "carbon_ending"]
|
||||||
# retain_features: ["SAP_STARTING", "TOTAL_FLOOR_AREA_DIFF"]
|
# retain_features: ["SAP_STARTING", "TOTAL_FLOOR_AREA_DIFF"]
|
||||||
retain_features: null
|
retain_features: null
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,44 +5,44 @@ stages:
|
||||||
deps:
|
deps:
|
||||||
- path: 1_prepare_data.py
|
- path: 1_prepare_data.py
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: c9f030df733e318b80d1fa91b7732f79
|
md5: 11a3b8bfdfe199ab7ecc39ccc5652649
|
||||||
size: 5132
|
size: 4298
|
||||||
params:
|
params:
|
||||||
configs/settings.yaml:
|
configs/settings.yaml:
|
||||||
default.feature_processor.feature_processor_config.drop_columns:
|
default.feature_processor.feature_processor_config.drop_columns:
|
||||||
- HEAT_DEMAND_CHANGE
|
- heat_demand_change
|
||||||
- CARBON_CHANGE
|
- carbon_change
|
||||||
- RDSAP_CHANGE
|
- rdsap_change
|
||||||
- HEAT_DEMAND_ENDING
|
- sap_ending
|
||||||
- CARBON_ENDING
|
- carbon_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: heat_demand_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-datalake-dev/dataset_with0perm_all.parquet
|
||||||
default.prepare_data.input_dataclient_type: aws-s3
|
default.prepare_data.input_dataclient_type: aws-s3
|
||||||
default.prepare_data.output_dataclient_type: local
|
default.prepare_data.output_dataclient_type: local
|
||||||
default.prepare_data.output_test_filepath: ./data/prepared_data/test.parquet
|
default.prepare_data.output_test_filepath: ./data/prepared_data/test.parquet
|
||||||
default.prepare_data.output_train_filepath: ./data/prepared_data/train.parquet
|
default.prepare_data.output_train_filepath: ./data/prepared_data/train.parquet
|
||||||
default.prepare_data.train_proportion: 0.9
|
default.prepare_data.train_proportion: 1
|
||||||
outs:
|
outs:
|
||||||
- path: data/prepared_data/
|
- path: data/prepared_data/
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 9ce5c45722da7fc40491b5a4d00daf9e.dir
|
md5: dcd41f841c67b474a81a14e683646237.dir
|
||||||
size: 33881619
|
size: 36317761
|
||||||
nfiles: 2
|
nfiles: 2
|
||||||
build_model:
|
build_model:
|
||||||
cmd: python 2_build_model.py
|
cmd: python 2_build_model.py
|
||||||
deps:
|
deps:
|
||||||
- path: 2_build_model.py
|
- path: 2_build_model.py
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 84699d208874c52accaff61c6af9bb0a
|
md5: 7231450b78920b0c5e7c6bada496b24a
|
||||||
size: 5359
|
size: 4820
|
||||||
- path: data/prepared_data
|
- path: data/prepared_data
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 9ce5c45722da7fc40491b5a4d00daf9e.dir
|
md5: dcd41f841c67b474a81a14e683646237.dir
|
||||||
size: 33881619
|
size: 36317761
|
||||||
nfiles: 2
|
nfiles: 2
|
||||||
params:
|
params:
|
||||||
configs/build_model.yaml:
|
configs/build_model.yaml:
|
||||||
|
|
@ -51,6 +51,7 @@ stages:
|
||||||
model_type: AutogluonAutoML
|
model_type: AutogluonAutoML
|
||||||
model_save_filepath: ./data/model/optimised/
|
model_save_filepath: ./data/model/optimised/
|
||||||
fit_metrics_filepath: ./metrics/fit_metrics.json
|
fit_metrics_filepath: ./metrics/fit_metrics.json
|
||||||
|
fit_predictions_filepath: ./data/fit_predictions/predictions.parquet
|
||||||
SKLearnLinearRegression:
|
SKLearnLinearRegression:
|
||||||
SKLearnSVMRegression:
|
SKLearnSVMRegression:
|
||||||
kernel: linear
|
kernel: linear
|
||||||
|
|
@ -61,34 +62,45 @@ stages:
|
||||||
time_limit: 4000
|
time_limit: 4000
|
||||||
presets: medium_quality
|
presets: medium_quality
|
||||||
excluded_model_types:
|
excluded_model_types:
|
||||||
- KNN
|
|
||||||
- RF
|
- RF
|
||||||
|
- FASTAI
|
||||||
|
- CAT
|
||||||
|
- NN_TORCH
|
||||||
|
- KNN
|
||||||
|
- XT
|
||||||
|
infer_limit: 0.05
|
||||||
|
infer_limit_batch_size: 10000
|
||||||
outs:
|
outs:
|
||||||
|
- path: data/fit_predictions/
|
||||||
|
hash: md5
|
||||||
|
md5: 89063bb3b725afe61b6ed5edb724bb06.dir
|
||||||
|
size: 3090627
|
||||||
|
nfiles: 1
|
||||||
- path: data/model/
|
- path: data/model/
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 7bb5156243b4db39349e80a01ffecde4.dir
|
md5: c90eef03b5a76175506c048e88a401dd.dir
|
||||||
size: 473398662
|
size: 783489255
|
||||||
nfiles: 27
|
nfiles: 32
|
||||||
- path: metrics/fit_metrics.json
|
- path: metrics/fit_metrics.json
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 2bb16ac67de8778fbc08171d562b34d5
|
md5: 33f18fa6b7dda535de09733d4792c0fc
|
||||||
size: 184
|
size: 217
|
||||||
generate_predictions:
|
generate_predictions:
|
||||||
cmd: python 3_generate_predictions.py
|
cmd: python 3_generate_predictions.py
|
||||||
deps:
|
deps:
|
||||||
- path: 3_generate_predictions.py
|
- path: 3_generate_predictions.py
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 5ef2856a5a977304f1ec01f9b4205262
|
md5: 0a70ad4dfe99414a75d1261c75a177b9
|
||||||
size: 3028
|
size: 2464
|
||||||
- path: data/model
|
- path: data/model
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 7bb5156243b4db39349e80a01ffecde4.dir
|
md5: c90eef03b5a76175506c048e88a401dd.dir
|
||||||
size: 473398662
|
size: 783489255
|
||||||
nfiles: 27
|
nfiles: 32
|
||||||
- path: data/prepared_data
|
- path: data/prepared_data
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 9ce5c45722da7fc40491b5a4d00daf9e.dir
|
md5: dcd41f841c67b474a81a14e683646237.dir
|
||||||
size: 33881619
|
size: 36317761
|
||||||
nfiles: 2
|
nfiles: 2
|
||||||
params:
|
params:
|
||||||
configs/settings.yaml:
|
configs/settings.yaml:
|
||||||
|
|
@ -100,25 +112,25 @@ stages:
|
||||||
outs:
|
outs:
|
||||||
- path: data/predictions/
|
- path: data/predictions/
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 0bb3cf991906953def81c8204cdcfaf0.dir
|
md5: 406e2ebe33d6abed9042f137d8c0d2bf.dir
|
||||||
size: 374532
|
size: 520735
|
||||||
nfiles: 1
|
nfiles: 1
|
||||||
generate_metrics:
|
generate_metrics:
|
||||||
cmd: python 4_generate_metrics.py
|
cmd: python 4_generate_metrics.py
|
||||||
deps:
|
deps:
|
||||||
- path: 4_generate_metrics.py
|
- path: 4_generate_metrics.py
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 2c9fb78955a8c19cff0a098976f81d1b
|
md5: 567b1acb819e2ff432b989cdbdd4a2bf
|
||||||
size: 4487
|
size: 3448
|
||||||
- path: data/predictions
|
- path: data/predictions
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 0bb3cf991906953def81c8204cdcfaf0.dir
|
md5: 406e2ebe33d6abed9042f137d8c0d2bf.dir
|
||||||
size: 374532
|
size: 520735
|
||||||
nfiles: 1
|
nfiles: 1
|
||||||
- path: data/prepared_data
|
- path: data/prepared_data
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 9ce5c45722da7fc40491b5a4d00daf9e.dir
|
md5: dcd41f841c67b474a81a14e683646237.dir
|
||||||
size: 33881619
|
size: 36317761
|
||||||
nfiles: 2
|
nfiles: 2
|
||||||
params:
|
params:
|
||||||
configs/settings.yaml:
|
configs/settings.yaml:
|
||||||
|
|
@ -128,15 +140,15 @@ stages:
|
||||||
outs:
|
outs:
|
||||||
- path: metrics/metrics.json
|
- path: metrics/metrics.json
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: 2e13ae67759a64261d03224f1c0d4bf4
|
md5: cc1ad408f2d9d3128df71822a38ea85e
|
||||||
size: 185
|
size: 218
|
||||||
startup_cleanup:
|
startup_cleanup:
|
||||||
cmd: python 0_startup_cleanup.py
|
cmd: python 0_startup_cleanup.py
|
||||||
deps:
|
deps:
|
||||||
- path: 0_startup_cleanup.py
|
- path: 0_startup_cleanup.py
|
||||||
hash: md5
|
hash: md5
|
||||||
md5: fbb7e3b1b98b517c870f3e1df3e7f695
|
md5: b1b12f6b6393fbf8b83d23684df0a3d4
|
||||||
size: 1676
|
size: 1220
|
||||||
params:
|
params:
|
||||||
configs/settings.yaml:
|
configs/settings.yaml:
|
||||||
default.startup_cleanup.artefacts: ./data
|
default.startup_cleanup.artefacts: ./data
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ stages:
|
||||||
- configs/build_model.yaml:
|
- configs/build_model.yaml:
|
||||||
outs:
|
outs:
|
||||||
- data/model/
|
- data/model/
|
||||||
|
- data/fit_predictions/
|
||||||
- metrics/fit_metrics.json
|
- metrics/fit_metrics.json
|
||||||
always_changed: true
|
always_changed: true
|
||||||
generate_predictions:
|
generate_predictions:
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ train_df[[target, "SAP_STARTING"]].plot(y=target, x="SAP_STARTING", style="o")
|
||||||
train_df[[target, "HEAT_DEMAND_STARTING"]].plot(
|
train_df[[target, "HEAT_DEMAND_STARTING"]].plot(
|
||||||
x=target, y="HEAT_DEMAND_STARTING", style="o"
|
x=target, y="HEAT_DEMAND_STARTING", style="o"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Both make sense: i.e. the higher the sap, the lower we predict and the higher the heat demand, the higher we predict
|
# Both make sense: i.e. the higher the sap, the lower we predict and the higher the heat demand, the higher we predict
|
||||||
|
|
||||||
# Load the autogluon model and check feature importance
|
# Load the autogluon model and check feature importance
|
||||||
|
|
@ -176,6 +175,8 @@ plot_permutation_importance(exp, fig_kw={"figwidth": 7, "figheight": 6})
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from core.MLMetrics import metrics_factory
|
||||||
|
|
||||||
from core.MLModels import model_factory
|
from core.MLModels import model_factory
|
||||||
from core.DataClient import dataclient_factory
|
from core.DataClient import dataclient_factory
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
@ -206,6 +207,9 @@ mix_df = pd.concat([test_df.copy(), predictions], axis=1)
|
||||||
mix_df["residual"] = abs(mix_df[predictions_column_name] - mix_df[target])
|
mix_df["residual"] = abs(mix_df[predictions_column_name] - mix_df[target])
|
||||||
mix_df = mix_df.sort_values("residual", ascending=False)
|
mix_df = mix_df.sort_values("residual", ascending=False)
|
||||||
|
|
||||||
|
metrics = metrics_factory("Regression")
|
||||||
|
metrics.generate_metrics(mix_df["predictions"], mix_df["HEAT_DEMAND_ENDING"])
|
||||||
|
|
||||||
cosine_similarity_df = mix_df[
|
cosine_similarity_df = mix_df[
|
||||||
mix_df.columns.difference(["predictions", "residual", "SAP_ENDING"])
|
mix_df.columns.difference(["predictions", "residual", "SAP_ENDING"])
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
dvc==3.18.0
|
dvc==3.36.0
|
||||||
dvc-s3==2.23.0
|
dvc-s3==3.0.1
|
||||||
gto==1.0.4
|
gto==1.6.1
|
||||||
pyOpenSSL==23.2.0
|
pyOpenSSL==23.3.0
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue