From e5db54dcf809bf70e64f6e6c2197aea749a8e898 Mon Sep 17 00:00:00 2001 From: Andrey Stebenkov Date: Thu, 15 Aug 2024 16:59:13 +0300 Subject: [PATCH] Fix bug with test_default_forecast (add new TODO for ts_forecasting) --- fedot/core/data/data.py | 4 ++-- fedot/preprocessing/preprocessing.py | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/fedot/core/data/data.py b/fedot/core/data/data.py index 3077f42e92..c8f39e9392 100644 --- a/fedot/core/data/data.py +++ b/fedot/core/data/data.py @@ -613,7 +613,7 @@ def get_not_encoded_data(self): num_features_names, cat_features_names = None, None # Checking numerical data exists - if self.numerical_idx: + if self.numerical_idx.any(): num_features = self.features[:, self.numerical_idx] if self.features_names is not None and np.size(self.features_names): @@ -622,7 +622,7 @@ def get_not_encoded_data(self): num_features_names = np.array([f'num_feature_{i}' for i in range(1, num_features.shape[1] + 1)]) # Checking categorical data exists - if self.categorical_idx: + if self.categorical_idx.any(): cat_features = self.categorical_features if self.features_names is not None and np.size(self.features_names): diff --git a/fedot/preprocessing/preprocessing.py b/fedot/preprocessing/preprocessing.py index 144d865eef..64e9720c3d 100644 --- a/fedot/preprocessing/preprocessing.py +++ b/fedot/preprocessing/preprocessing.py @@ -595,11 +595,16 @@ def reduce_mem_usage_np(arr, initial_types): return reduced_columns if isinstance(data, InputData): - self.log.message('-- Reduce memory in features') - data.features = reduce_mem_usage_np(data.features, data.supplementary_data.col_type_ids['features']) + if data.task.task_type == TaskTypesEnum.ts_forecasting: + # TODO: TS data has col_type_ids['features'] = None. + # It required to add this to reduce memory for them + pass + else: + self.log.message('-- Reduce memory in features') + data.features = reduce_mem_usage_np(data.features, data.supplementary_data.col_type_ids['features']) - self.log.message('-- Reduce memory in target') - data.target = reduce_mem_usage_np(data.target, data.supplementary_data.col_type_ids['target']) + self.log.message('-- Reduce memory in target') + data.target = reduce_mem_usage_np(data.target, data.supplementary_data.col_type_ids['target']) return data