diff --git a/.idea/Model.iml b/.idea/Model.iml index 03f5e8e2..0ded8e60 100644 --- a/.idea/Model.iml +++ b/.idea/Model.iml @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index daffedc9..ae87bfde 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/model_data/simulation_system/core/Helpers.py b/model_data/simulation_system/core/Helpers.py deleted file mode 100644 index 65491c42..00000000 --- a/model_data/simulation_system/core/Helpers.py +++ /dev/null @@ -1,17 +0,0 @@ -from pathlib import Path - - -def ensure_relative_path(file_path: str, relative_to: str | Path = None) -> Path: - """ - Convert the given path to a relative path. - - :param file_path: The path to check and possibly convert. - :param relative_to: Optional path to which the given path should be made relative. - If not provided, the current working directory is used. - :return: The relative path. - """ - path = Path(file_path) - if path.is_absolute(): - base_path = Path(relative_to) if relative_to else Path.cwd() - return path.relative_to(base_path) - return path diff --git a/model_data/simulation_system/requirements/prediction.txt b/model_data/simulation_system/requirements/prediction.txt index e69de29b..f9ce32bf 100644 --- a/model_data/simulation_system/requirements/prediction.txt +++ b/model_data/simulation_system/requirements/prediction.txt @@ -0,0 +1,2 @@ +autogluon==0.8.2 +pandas==1.5.3 \ No newline at end of file diff --git a/model_data/simulation_system/training.py b/model_data/simulation_system/training.py index d67a7e58..2a1dfcfa 100644 --- a/model_data/simulation_system/training.py +++ b/model_data/simulation_system/training.py @@ -8,6 +8,7 @@ from model_data.simulation_system.core.FeatureProcessor import FeatureProcessor from model_data.simulation_system.MLModel.Models import AutogluonModel import pandas as pd from model_data.simulation_system.core.Settings import ( + MODEL_DIRECTORY, BASE_REGISTRY_PATH, REGISTRY_FILE, MODEL_FOLDER, @@ -16,7 +17,6 @@ from model_data.simulation_system.core.Settings import ( SUBSAMPLE_FACTOR, MODEL_HYPERPARAMETERS ) -from model_data.simulation_system.core.Helpers import ensure_relative_path import seaborn as sns import matplotlib.pyplot as plt @@ -100,7 +100,7 @@ def training( if model_type == "autogluon": model_root = f"{target_column}-{hyperparameters['presets']}-{hyperparameters['time_limit']}-{TIMESTAMP}".lower() - output_base = BASE_REGISTRY_PATH / target_column / model_type / model_root + output_base = Path(MODEL_DIRECTORY) / target_column / model_type / model_root model = AutogluonModel( output_filepath=output_base / MODEL_FOLDER @@ -157,9 +157,6 @@ def training( logger.info("--- Optimising model for deployment ---") deployment_model_path = model.optimise_model_for_deployment(deployment_path=output_base / DEPLOYMENT_FOLDER) - # Autogluon requires models to be stored at relative paths. This will likely eventually be s3 however we - # make sure the path is relative to the location of this script - deployment_model_path = ensure_relative_path(deployment_model_path, Path(__file__).parent) logger.info(f"Optimised version of best model can be found at: {deployment_model_path}") # TODO: Need a model registry - for now have this as a CSV