Strategies
Evaluation
Interface
- class fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy(operation_type, params=None)[source]
Bases:
object
Base class to define the evaluation strategy of Operation object: the certain sklearn or any other operation with fit/predict methods.
- Parameters
operation_type (str) –
str
of the operation defined in operation repositoryparams (Optional[fedot.core.operations.operation_parameters.OperationParameters]) – hyperparameters to fit the operation with
- abstract fit(train_data)[source]
Main method to train the operation with the data provided
- Parameters
train_data (InputData) – data used for operation training
Returns:
- abstract predict(trained_operation, predict_data)[source]
Method to predict the target data for predict stage.
- Parameters
trained_operation – trained operation object
predict_data (InputData) – data to predict
- Returns
passed data with new predicted target
- Return type
- predict_for_fit(trained_operation, predict_data)[source]
Method to predict the target data for fit stage. Allows to implement predict method different from main predict method if another behaviour for fit graph stage is needed.
- Parameters
trained_operation – trained operation object
predict_data (InputData) – data to predict
- Returns
passed data with new predicted target
- Return type
- static _convert_to_output(prediction, predict_data, output_data_type=DataTypesEnum.table)[source]
Method convert prediction into
OutputData
if it is not this type yet- Parameters
prediction – output from model implementation
predict_data (InputData) –
InputData
used for predictionoutput_data_type (DataTypesEnum) –
DataTypesEnum
for output
- Return type
Returns: prediction as
OutputData
- class fedot.core.operations.evaluation.evaluation_interfaces.SkLearnEvaluationStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
This class defines the certain operation implementation for the sklearn operations defined in operation repository
- Parameters
operation_type (str) –
str
of the operation defined in operation or data operation repositoriespossible operations:
xgbreg
-> XGBRegressoradareg
-> AdaBoostRegressorgbr
-> GradientBoostingRegressordtreg
-> DecisionTreeRegressortreg
-> ExtraTreesRegressorrfr
-> RandomForestRegressorlinear
-> SklearnLinRegridge
-> SklearnRidgeReglasso
-> SklearnLassoRegsvr
-> SklearnSVRsgdr
-> SklearnSGDlgbmreg
-> LGBMRegressorxgboost
-> XGBClassifierlogit
-> SklearnLogRegbernb
-> SklearnBernoulliNBmultinb
-> SklearnMultinomialNBdt
-> DecisionTreeClassifierrf
-> RandomForestClassifiermlp
-> MLPClassifierlgbm
-> LGBMClassifierkmeans
-> SklearnKmeans
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) – hyperparameters to fit the operation with
- fit(train_data)[source]
This method is used for operation training with the data provided
- Parameters
train_data (InputData) – data used for operation training
- Returns
trained Sklearn operation
- fedot.core.operations.evaluation.evaluation_interfaces.convert_to_multivariate_model(sklearn_model, train_data)[source]
The function returns an iterator for multiple target for those models for which such a function is not initially provided
- Parameters
sklearn_model –
Sklearn model
to traintrain_data (InputData) – data used for model training
- Returns
wrapped
Sklearn model
Classification
- class fedot.core.operations.evaluation.classification.SkLearnClassificationStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.SkLearnEvaluationStrategy
Strategy for applying classification algorithms from Sklearn library
- Parameters
operation_type (str) –
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) –
- class fedot.core.operations.evaluation.classification.FedotClassificationStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
- Parameters
operation_type (str) –
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) –
- fit(train_data)[source]
This method is used for operation training with the data provided :param InputData train_data: data used for operation training :return: trained data operation
- Parameters
train_data (InputData) –
- class fedot.core.operations.evaluation.classification.FedotClassificationPreprocessingStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
Strategy for applying custom algorithms from FEDOT to preprocess data for classification task
- Parameters
operation_type (str) –
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) –
- fit(train_data)[source]
This method is used for operation training with the data provided :param InputData train_data: data used for operation training :return: trained data operation
- Parameters
train_data (InputData) –
- predict(trained_operation, predict_data)[source]
Transform data for predict stage
- Parameters
trained_operation – model object
predict_data (InputData) – data used for prediction
- Returns
prediction target
- Return type
Regression
- class fedot.core.operations.evaluation.regression.SkLearnRegressionStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.SkLearnEvaluationStrategy
- Parameters
operation_type (str) –
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) –
- class fedot.core.operations.evaluation.regression.FedotRegressionPreprocessingStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
Strategy for applying custom algorithms from FEDOT to preprocess data for regression task
- Parameters
operation_type (str) –
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) –
- fit(train_data)[source]
This method is used for operation training with the data provided :param InputData train_data: data used for operation training :return: trained data operation
- Parameters
train_data (InputData) –
- predict(trained_operation, predict_data)[source]
Transform method for preprocessing for predict stage
- Parameters
trained_operation – model object
predict_data (InputData) – data used for prediction
- Returns
- Return type
- class fedot.core.operations.evaluation.regression.FedotRegressionStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
Strategy for applying custom regression models from FEDOT make predictions
- Parameters
operation_type (str) –
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) –
- fit(train_data)[source]
This method is used for operation training
- Parameters
train_data (InputData) –
- predict(trained_operation, predict_data)[source]
Method to predict the target data for predict stage.
- Parameters
trained_operation – trained operation object
predict_data (InputData) – data to predict
- Returns
passed data with new predicted target
- Return type
- predict_for_fit(trained_operation, predict_data)[source]
Method to predict the target data for fit stage. Allows to implement predict method different from main predict method if another behaviour for fit graph stage is needed.
- Parameters
trained_operation – trained operation object
predict_data (InputData) – data to predict
- Returns
passed data with new predicted target
- Return type
Time-series
- class fedot.core.operations.evaluation.time_series.FedotTsForecastingStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
This class defines the certain classical models implementation for time series forecasting (e.g. AR, ARIMA)
- Parameters
operation_type (str) – str type of the operation defined in operation or data operation repositories
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) – hyperparameters to fit the model with
- fit(train_data)[source]
This method is used for operation training with the data provided :param InputData train_data: data used for operation training :return: trained model
- Parameters
train_data (InputData) –
- predict(trained_operation, predict_data)[source]
This method used for prediction of the target data during predict stage.
- Parameters
trained_operation – trained operation object
predict_data (InputData) – data to predict
- Return OutputData
passed data with new predicted target
- Return type
- class fedot.core.operations.evaluation.time_series.FedotTsTransformingStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
This class defines the certain data operation implementation for time series forecasting
- Parameters
operation_type (str) – str type of the operation defined in operation or data operation repositories
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) – hyperparameters to fit the model with
- fit(train_data)[source]
This method is used for operation training with the data provided :param InputData train_data: data used for operation training :return: trained operation (if it is needed for applying)
- Parameters
train_data (InputData) –
- predict(trained_operation, predict_data)[source]
This method used for prediction of the target data during predict stage.
- Parameters
trained_operation – trained operation object
predict_data (InputData) – data to predict
- Return OutputData
passed data with new predicted target
- Return type
Clustering
- class fedot.core.operations.evaluation.clustering.SkLearnClusteringStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.SkLearnEvaluationStrategy
- Parameters
operation_type (str) –
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) –
- fit(train_data)[source]
Fit method for clustering task
- Parameters
train_data (InputData) – data used for model training
AutoML
- class fedot.core.operations.evaluation.automl.H2OAutoMLRegressionStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
- Parameters
operation_type (str) –
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) –
- fit(train_data)[source]
Main method to train the operation with the data provided
- Parameters
train_data (InputData) – data used for operation training
Returns:
- class fedot.core.operations.evaluation.automl.H2OAutoMLClassificationStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
- Parameters
operation_type (str) –
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) –
- fit(train_data)[source]
Main method to train the operation with the data provided
- Parameters
train_data (InputData) – data used for operation training
Returns:
- class fedot.core.operations.evaluation.automl.TPOTAutoMLRegressionStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
- Parameters
operation_type (str) –
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) –
- fit(train_data)[source]
Main method to train the operation with the data provided
- Parameters
train_data (InputData) – data used for operation training
Returns:
- class fedot.core.operations.evaluation.automl.TPOTAutoMLClassificationStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
- Parameters
operation_type (str) –
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) –
- fit(train_data)[source]
Main method to train the operation with the data provided
- Parameters
train_data (InputData) – data used for operation training
Returns:
Text
- class fedot.core.operations.evaluation.text.SkLearnTextVectorizeStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
- Parameters
operation_type (str) –
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) –
- fit(train_data)[source]
Main method to train the operation with the data provided
- Parameters
train_data (InputData) – data used for operation training
Returns:
- class fedot.core.operations.evaluation.text.FedotTextPreprocessingStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
- Parameters
operation_type (str) –
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) –
- fit(train_data)[source]
This method is used for operation training with the data provided
- Parameters
train_data (InputData) – data used for operation training
- Returns
trained model
- predict(trained_operation, predict_data)[source]
This method used for prediction of the target data during predict stage.
- Parameters
trained_operation – trained operation object
predict_data (InputData) – data to predict
- Return OutputData
passed data with new predicted target
- Return type
- class fedot.core.operations.evaluation.text.GensimTextVectorizeStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
- Parameters
operation_type (str) –
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) –
- fit(train_data)[source]
Class doesn’t support fit operation
- Parameters
train_data (InputData) – data with features, target and ids to process
- predict(trained_operation, predict_data)[source]
Method to predict the target data for predict stage.
- Parameters
trained_operation – trained operation object
predict_data (InputData) – data to predict
- Returns
passed data with new predicted target
- Return type
- predict_for_fit(trained_operation, predict_data)[source]
Method to predict the target data for fit stage. Allows to implement predict method different from main predict method if another behaviour for fit graph stage is needed.
- Parameters
trained_operation – trained operation object
predict_data (InputData) – data to predict
- Returns
passed data with new predicted target
- Return type
Custom
- class fedot.core.operations.evaluation.custom.CustomModelStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
This class defines the default model container for custom of domain-specific implementations
- Parameters
operation_type (Optional[str]) – rudimentary of parent - type of the operation defined in operation or data operation repositories
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) – hyperparameters to fit the model with
- predict(trained_operation, predict_data)[source]
Method to predict the target data for predict stage.
- Parameters
trained_operation – trained operation object
predict_data (InputData) – data to predict
- Returns
passed data with new predicted target
- Return type
- predict_for_fit(trained_operation, predict_data)[source]
Method to predict the target data for fit stage. Allows to implement predict method different from main predict method if another behaviour for fit graph stage is needed.
- Parameters
trained_operation – trained operation object
predict_data (InputData) – data to predict
- Returns
passed data with new predicted target
- Return type
GPU Evaluation
Interface
- class fedot.core.operations.evaluation.gpu.common.CuMLEvaluationStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.SkLearnEvaluationStrategy
This class defines the certain operation implementation for the GPU-based CuML operations defined in operation repository :param str operation_type: str type of the operation defined in operation or data operation repositories :param dict params: hyperparameters to fit the operation with
- Parameters
operation_type (str) –
params (Optional[dict]) –
- fit(train_data)[source]
This method is used for operation training with the data provided :param InputData train_data: data used for operation training :return: trained cuML operation
- Parameters
train_data (InputData) –
- abstract predict(trained_operation, predict_data)[source]
This method used for prediction of the target data during predict stage. :param trained_operation: operation object :param predict_data: data to predict :return OutputData: passed data with new predicted target
- Parameters
predict_data (InputData) –
- Return type
CuMLRegressionClassification
- class fedot.core.operations.evaluation.gpu.classification.CuMLClassificationStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.gpu.common.CuMLEvaluationStrategy
Strategy for applying classification algorithms from Sklearn library
- Parameters
operation_type (str) –
params (Optional[dict]) –
CuMLRegressionStrategy
- class fedot.core.operations.evaluation.gpu.regression.CuMLRegressionStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.gpu.common.CuMLEvaluationStrategy
- Parameters
operation_type (str) –
params (Optional[dict]) –
CuMLClusteringStrategy
- class fedot.core.operations.evaluation.gpu.clustering.CumlClusteringStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.gpu.common.CuMLEvaluationStrategy
- Parameters
operation_type (str) –
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) –
- fit(train_data)[source]
Fit method for clustering task
- Parameters
train_data (InputData) – data used for model training
- Returns
Data
Data source
- class fedot.core.operations.evaluation.data_source.DataSourceStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
- Parameters
operation_type (str) –
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) –
- fit(train_data)[source]
Main method to train the operation with the data provided
- Parameters
train_data (InputData) – data used for operation training
Returns:
Preprocessing
- class fedot.core.operations.evaluation.common_preprocessing.FedotPreprocessingStrategy(operation_type, params=None)[source]
Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
- Parameters
operation_type (str) –
str
of the operation defined in operation or data operation repositoriespossible operations:
scaling
-> ScalingImplementation,normalization
-> NormalizationImplementation,simple_imputation
-> ImputationImplementation,pca
-> PCAImplementation,kernel_pca
-> KernelPCAImplementation,poly_features
-> PolyFeaturesImplementation,one_hot_encoding
-> OneHotEncodingImplementation,label_encoding
-> LabelEncodingImplementation,fast_ica
-> FastICAImplementation
params (Optional[fedot.core.operations.operation_parameters.OperationParameters]) – hyperparameters to fit the operation with
- fit(train_data)[source]
This method is used for operation training with the data provided
- Parameters
train_data (InputData) – data used for operation training
- Returns
trained Sklearn operation
- predict(trained_operation, predict_data)[source]
Transform method for preprocessing task
- Parameters
trained_operation – model object
predict_data (InputData) – data used for prediction
- Returns
prediction
- Return type