From 404a5a5430e15787767feb61c1073c72401a79c0 Mon Sep 17 00:00:00 2001 From: morrisnein Date: Thu, 1 Jun 2023 21:03:24 +0300 Subject: [PATCH] rename DataManager -> FileSystemManager --- experiments/fedot_warm_start/run.py | 4 ++-- meta_automl/data_preparation/dataset/file_dataset.py | 4 ++-- meta_automl/data_preparation/dataset/openml_dataset.py | 4 ++-- .../data_preparation/datasets_loaders/datasets_loader.py | 4 ++-- .../{data_manager.py => file_system_manager.py} | 2 +- .../meta_features_extractors/meta_features_extractor.py | 4 ++-- .../data_preparation/models_loaders/fedot_pipelines_loader.py | 2 +- .../models_loaders/knowledge_base_models_loader.py | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) rename meta_automl/data_preparation/{data_manager.py => file_system_manager.py} (99%) diff --git a/experiments/fedot_warm_start/run.py b/experiments/fedot_warm_start/run.py index 8ccf659f..45ac01d6 100644 --- a/experiments/fedot_warm_start/run.py +++ b/experiments/fedot_warm_start/run.py @@ -22,7 +22,7 @@ from sklearn.model_selection import StratifiedKFold from tqdm import tqdm -from meta_automl.data_preparation.data_manager import DataManager +from meta_automl.data_preparation.file_system_manager import FileSystemManager from meta_automl.data_preparation.dataset import OpenMLDataset, DatasetData from meta_automl.data_preparation.datasets_loaders import OpenMLDatasetsLoader from meta_automl.data_preparation.datasets_train_test_split import openml_datasets_train_test_split @@ -61,7 +61,7 @@ time_now = datetime.now() time_now_iso = time_now.isoformat(timespec="minutes") time_now_for_path = time_now_iso.replace(":", ".") -save_dir = DataManager.get_data_dir(). \ +save_dir = FileSystemManager.get_data_dir(). \ joinpath('experiments').joinpath('fedot_warm_start').joinpath(f'run_{time_now_for_path}') save_dir.mkdir(parents=True) log_file = save_dir.joinpath('log.txt') diff --git a/meta_automl/data_preparation/dataset/file_dataset.py b/meta_automl/data_preparation/dataset/file_dataset.py index 4e591eec..efbe3a63 100644 --- a/meta_automl/data_preparation/dataset/file_dataset.py +++ b/meta_automl/data_preparation/dataset/file_dataset.py @@ -3,7 +3,7 @@ import pickle from pathlib import Path -from meta_automl.data_preparation.data_manager import DataManager +from meta_automl.data_preparation.file_system_manager import FileSystemManager from meta_automl.data_preparation.dataset import DatasetBase from meta_automl.data_preparation.dataset.dataset_base import DatasetData @@ -17,7 +17,7 @@ class FileDataset(DatasetBase): @property def cache_path(self) -> Path: - return DataManager.get_dataset_cache_path(self.id_, self.source_name) + return FileSystemManager.get_dataset_cache_path(self.id_, self.source_name) def get_data(self) -> DatasetData: if not self.cache_path.exists(): diff --git a/meta_automl/data_preparation/dataset/openml_dataset.py b/meta_automl/data_preparation/dataset/openml_dataset.py index 78a99003..464a5031 100644 --- a/meta_automl/data_preparation/dataset/openml_dataset.py +++ b/meta_automl/data_preparation/dataset/openml_dataset.py @@ -2,12 +2,12 @@ import openml -from meta_automl.data_preparation.data_manager import DataManager +from meta_automl.data_preparation.file_system_manager import FileSystemManager from meta_automl.data_preparation.dataset import DatasetBase from meta_automl.data_preparation.dataset.dataset_base import DatasetData OpenMLDatasetIDType = int -openml_cache_path = str(DataManager.get_data_dir().joinpath('openml_cache')) +openml_cache_path = str(FileSystemManager.get_data_dir().joinpath('openml_cache')) openml.config.set_cache_directory(openml_cache_path) diff --git a/meta_automl/data_preparation/datasets_loaders/datasets_loader.py b/meta_automl/data_preparation/datasets_loaders/datasets_loader.py index 1bb843b0..278ad271 100644 --- a/meta_automl/data_preparation/datasets_loaders/datasets_loader.py +++ b/meta_automl/data_preparation/datasets_loaders/datasets_loader.py @@ -3,12 +3,12 @@ from abc import abstractmethod from typing import List, Type -from meta_automl.data_preparation.data_manager import DataManager +from meta_automl.data_preparation.file_system_manager import FileSystemManager from meta_automl.data_preparation.dataset import DatasetBase class DatasetsLoader: - data_manager: Type[DataManager] = DataManager + data_manager: Type[FileSystemManager] = FileSystemManager @abstractmethod def load(self, *args, **kwargs) -> List[DatasetBase]: diff --git a/meta_automl/data_preparation/data_manager.py b/meta_automl/data_preparation/file_system_manager.py similarity index 99% rename from meta_automl/data_preparation/data_manager.py rename to meta_automl/data_preparation/file_system_manager.py index 5e1556ec..140c70bc 100644 --- a/meta_automl/data_preparation/data_manager.py +++ b/meta_automl/data_preparation/file_system_manager.py @@ -8,7 +8,7 @@ PathType = Union[PathLike, str] -class DataManager: +class FileSystemManager: default_cache_extension = '.pkl' @classmethod diff --git a/meta_automl/data_preparation/meta_features_extractors/meta_features_extractor.py b/meta_automl/data_preparation/meta_features_extractors/meta_features_extractor.py index 43fc43be..405661bb 100644 --- a/meta_automl/data_preparation/meta_features_extractors/meta_features_extractor.py +++ b/meta_automl/data_preparation/meta_features_extractors/meta_features_extractor.py @@ -5,14 +5,14 @@ import pandas as pd -from meta_automl.data_preparation.data_manager import DataManager +from meta_automl.data_preparation.file_system_manager import FileSystemManager from meta_automl.data_preparation.dataset import DatasetIDType class MetaFeaturesExtractor: default_params: Optional[Dict[str, Any]] = None source_name: Optional[str] = None - data_manager: Type[DataManager] = DataManager + data_manager: Type[FileSystemManager] = FileSystemManager @abstractmethod def extract(self, datasets) -> pd.DataFrame: diff --git a/meta_automl/data_preparation/models_loaders/fedot_pipelines_loader.py b/meta_automl/data_preparation/models_loaders/fedot_pipelines_loader.py index ae7f0b38..804a65fb 100644 --- a/meta_automl/data_preparation/models_loaders/fedot_pipelines_loader.py +++ b/meta_automl/data_preparation/models_loaders/fedot_pipelines_loader.py @@ -14,7 +14,7 @@ from golem.core.log import default_log from tqdm import tqdm -from meta_automl.data_preparation.data_manager import PathType +from meta_automl.data_preparation.file_system_manager import PathType from meta_automl.data_preparation.dataset import DatasetCache from meta_automl.data_preparation.datasets_loaders import DatasetsLoader, OpenMLDatasetsLoader from meta_automl.data_preparation.model import Model diff --git a/meta_automl/data_preparation/models_loaders/knowledge_base_models_loader.py b/meta_automl/data_preparation/models_loaders/knowledge_base_models_loader.py index e26b896e..96997d9f 100644 --- a/meta_automl/data_preparation/models_loaders/knowledge_base_models_loader.py +++ b/meta_automl/data_preparation/models_loaders/knowledge_base_models_loader.py @@ -7,12 +7,12 @@ from fedot.core.pipelines.pipeline import Pipeline from golem.core.optimisers.fitness import SingleObjFitness -from meta_automl.data_preparation.data_manager import DataManager +from meta_automl.data_preparation.file_system_manager import FileSystemManager from meta_automl.data_preparation.dataset import DatasetCache from meta_automl.data_preparation.model import Model from meta_automl.data_preparation.models_loaders import ModelsLoader -DEFAULT_KNOWLEDGE_BASE_PATH = DataManager.get_data_dir().joinpath('knowledge_base_0') +DEFAULT_KNOWLEDGE_BASE_PATH = FileSystemManager.get_data_dir().joinpath('knowledge_base_0') class KnowledgeBaseModelsLoader(ModelsLoader):