-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
v1docq
committed
Dec 30, 2023
1 parent
6b38dde
commit d5c972d
Showing
10 changed files
with
185 additions
and
405 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 0 additions & 64 deletions
64
fedot_ind/core/operation/interfaces/fedot_nn_evaluation_strategy.py
This file was deleted.
Oops, something went wrong.
83 changes: 0 additions & 83 deletions
83
fedot_ind/core/operation/interfaces/industrial_base_strategy.py
This file was deleted.
Oops, something went wrong.
104 changes: 104 additions & 0 deletions
104
fedot_ind/core/operation/interfaces/industrial_model_strategy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
from fedot.core.operations.evaluation.time_series import FedotTsForecastingStrategy | ||
from fedot.core.operations.evaluation.evaluation_interfaces import EvaluationStrategy | ||
from fedot.core.operations.evaluation.operation_implementations.data_operations.sklearn_transformations import * | ||
from fedot.core.operations.operation_parameters import OperationParameters | ||
|
||
from fedot_ind.core.operation.interfaces.industrial_preprocessing_strategy import MultiDimPreprocessingStrategy, \ | ||
IndustrialCustomPreprocessingStrategy | ||
from fedot_ind.core.repository.model_repository import SKLEARN_CLF_MODELS, SKLEARN_REG_MODELS, NEURAL_MODEL | ||
from fedot_ind.core.models.nn.network_impl.patch_tst import PatchTSTModel | ||
|
||
|
||
class FedotNNClassificationStrategy(EvaluationStrategy): | ||
__operations_by_types = NEURAL_MODEL | ||
|
||
def _convert_to_operation(self, operation_type: str): | ||
if operation_type in self.__operations_by_types.keys(): | ||
return self.__operations_by_types[operation_type] | ||
else: | ||
raise ValueError(f'Impossible to obtain custom preprocessing strategy for {operation_type}') | ||
|
||
def __init__(self, operation_type: str, params: Optional[OperationParameters] = None): | ||
super().__init__(operation_type, params) | ||
self.operation_impl = self._convert_to_operation(operation_type) | ||
self.output_mode = params.get('output_mode', 'labels') | ||
self.multi_dim_dispatcher = MultiDimPreprocessingStrategy(self.operation_impl, | ||
operation_type, | ||
mode='multi_dimensional') | ||
|
||
def fit(self, train_data: InputData): | ||
return self.multi_dim_dispatcher.fit(train_data) | ||
|
||
def predict(self, trained_operation, predict_data: InputData, output_mode: str = 'default') -> OutputData: | ||
return self.multi_dim_dispatcher.predict(trained_operation, predict_data, output_mode=output_mode) | ||
|
||
def predict_for_fit(self, trained_operation, predict_data: InputData, output_mode: str = 'default') -> OutputData: | ||
return self.multi_dim_dispatcher.predict_for_fit(trained_operation, predict_data, output_mode=output_mode) | ||
|
||
|
||
class FedotNNTimeSeriesStrategy(FedotTsForecastingStrategy): | ||
__operations_by_types = { | ||
'patch_tst_model': PatchTSTModel | ||
} | ||
|
||
def _convert_to_operation(self, operation_type: str): | ||
if operation_type in self.__operations_by_types.keys(): | ||
return self.__operations_by_types[operation_type] | ||
else: | ||
raise ValueError(f'Impossible to obtain custom preprocessing strategy for {operation_type}') | ||
|
||
def __init__(self, operation_type: str, params: Optional[OperationParameters] = None): | ||
self.operation_impl = self._convert_to_operation(operation_type) | ||
super().__init__(operation_type, params) | ||
|
||
|
||
class IndustrialSkLearnEvaluationStrategy(IndustrialCustomPreprocessingStrategy): | ||
|
||
def __init__(self, operation_type: str, params: Optional[OperationParameters] = None): | ||
super().__init__(operation_type, params) | ||
self.operation_impl = self._convert_to_operation(operation_type) | ||
self.multi_dim_dispatcher = MultiDimPreprocessingStrategy(self.operation_impl, | ||
operation_type, | ||
mode='one_dimensional') | ||
|
||
def fit(self, train_data: InputData): | ||
return self.multi_dim_dispatcher.fit(train_data) | ||
|
||
def predict(self, trained_operation, predict_data: InputData, output_mode: str = 'default') -> OutputData: | ||
return self.multi_dim_dispatcher.predict(trained_operation, predict_data, output_mode=output_mode) | ||
|
||
def predict_for_fit(self, trained_operation, predict_data: InputData, output_mode: str = 'default') -> OutputData: | ||
return self.multi_dim_dispatcher.predict_for_fit(trained_operation, predict_data, output_mode=output_mode) | ||
|
||
|
||
class IndustrialSkLearnClassificationStrategy(IndustrialSkLearnEvaluationStrategy): | ||
""" Strategy for applying classification algorithms from Sklearn library """ | ||
_operations_by_types = SKLEARN_CLF_MODELS | ||
|
||
def __init__(self, operation_type: str, params: Optional[OperationParameters] = None): | ||
super().__init__(operation_type, params) | ||
|
||
|
||
class IndustrialSkLearnRegressionStrategy(IndustrialSkLearnEvaluationStrategy): | ||
""" Strategy for applying regression algorithms from Sklearn library """ | ||
_operations_by_types = SKLEARN_REG_MODELS | ||
|
||
def __init__(self, operation_type: str, params: Optional[OperationParameters] = None): | ||
super().__init__(operation_type, params) | ||
|
||
def predict(self, trained_operation, predict_data: InputData, output_mode: str = 'labels') -> OutputData: | ||
return self.multi_dim_dispatcher.predict(trained_operation, predict_data, output_mode='labels') | ||
|
||
def predict_for_fit(self, trained_operation, predict_data: InputData, output_mode: str = 'labels') -> OutputData: | ||
return self.multi_dim_dispatcher.predict_for_fit(trained_operation, predict_data, output_mode='labels') | ||
|
||
|
||
class IndustrialCustomRegressionStrategy(IndustrialSkLearnEvaluationStrategy): | ||
_operations_by_types = SKLEARN_REG_MODELS | ||
|
||
def __init__(self, operation_type: str, params: Optional[OperationParameters] = None): | ||
super().__init__(operation_type, params) | ||
|
||
def fit(self, train_data: InputData): | ||
train_data = self.multi_dim_dispatcher._convert_input_data(train_data) | ||
return self.multi_dim_dispatcher.fit(train_data) |
Oops, something went wrong.