Skip to content

Commit

Permalink
Refactor imports and clean up ApiManager methods for improved readabi…
Browse files Browse the repository at this point in the history
…lity
  • Loading branch information
technocreep committed Nov 8, 2024
1 parent 4bec9e5 commit f63dc39
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions fedot_ind/api/utils/api_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@
from pymonad.either import Either

from fedot_ind.api.utils.industrial_strategy import IndustrialStrategy
from fedot_ind.api.utils.path_lib import DEFAULT_PATH_RESULTS as default_path_to_save_results
from fedot_ind.api.utils.path_lib import (
DEFAULT_PATH_RESULTS as default_path_to_save_results,
)
from fedot_ind.core.architecture.preprocessing.data_convertor import ApiConverter
from fedot_ind.core.optimizer.IndustrialEvoOptimizer import IndustrialEvoOptimizer
from fedot_ind.core.repository.constanst_repository import \
FEDOT_API_PARAMS, fedot_init_assumptions
from fedot_ind.core.repository.model_repository import default_industrial_availiable_operation
from fedot_ind.core.repository.constanst_repository import (
FEDOT_API_PARAMS,
fedot_init_assumptions,
)
from fedot_ind.core.repository.model_repository import (
default_industrial_availiable_operation,
)
from fedot_ind.tools.explain.explain import PointExplainer, RecurrenceExplainer


Expand Down Expand Up @@ -67,7 +73,6 @@ def create_path(self, kwargs):
def industrial_config_object(self, kwargs):
# map Fedot params to Industrial params
self.config_dict = kwargs
# self.config_dict['history_dir'] = prefix
self.preset = kwargs.get('preset', self.config_dict['problem'])
self.config_dict['available_operations'] = kwargs.get(
'available_operations',
Expand All @@ -89,11 +94,11 @@ def industrial_config_object(self, kwargs):

if self.task_params is not None and self.config_dict['problem'] == 'ts_forecasting':
self.config_dict['task_params'] = TsForecastingParams(forecast_length=self.task_params['forecast_length'])

self.__init_experiment_setup()

def industrial_api_object(self):
# init hidden state variables

self.explain_methods = {'point': PointExplainer,
'recurrence': RecurrenceExplainer,
'shap': NotImplementedError,
Expand All @@ -105,7 +110,8 @@ def industrial_api_object(self):
api_config=self.config_dict,
industrial_strategy=self.industrial_strategy,
industrial_strategy_params=self.industrial_strategy_params,
logger=self.logger)
logger=self.logger
)
self.industrial_strategy = self.industrial_strategy if self.industrial_strategy != 'anomaly_detection' else None

def __init_experiment_setup(self):
Expand All @@ -114,8 +120,3 @@ def __init_experiment_setup(self):
industrial_params = set(self.config_dict.keys()) - set(FEDOT_API_PARAMS.keys())
for param in industrial_params:
self.config_dict.pop(param, None)

# backend_method_current, backend_scipy_current = BackendMethods(
# self.backend_method).backend
# globals()['backend_methods'] = backend_method_current
# globals()['backend_scipy'] = backend_scipy_current

0 comments on commit f63dc39

Please sign in to comment.