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 repository

  • params (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

OutputData

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

OutputData

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 prediction

  • output_data_type (DataTypesEnum) – DataTypesEnum for output

Return type

OutputData

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 repositories

    possible operations:
    • xgbreg-> XGBRegressor

    • adareg-> AdaBoostRegressor

    • gbr-> GradientBoostingRegressor

    • dtreg-> DecisionTreeRegressor

    • treg-> ExtraTreesRegressor

    • rfr-> RandomForestRegressor

    • linear-> SklearnLinReg

    • ridge-> SklearnRidgeReg

    • lasso-> SklearnLassoReg

    • svr-> SklearnSVR

    • sgdr-> SklearnSGD

    • lgbmreg-> LGBMRegressor

    • xgboost-> XGBClassifier

    • logit-> SklearnLogReg

    • bernb-> SklearnBernoulliNB

    • multinb-> SklearnMultinomialNB

    • dt-> DecisionTreeClassifier

    • rf-> RandomForestClassifier

    • mlp-> MLPClassifier

    • lgbm-> LGBMClassifier

    • kmeans-> 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

abstract predict(trained_operation, predict_data)[source]

This method used for prediction of the target data

Parameters
  • trained_operation – operation object

  • predict_data (InputData) – data to predict

Returns

passed data with new predicted target

Return type

OutputData

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_modelSklearn model to train

  • train_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]) –

predict(trained_operation, predict_data)[source]

Predict method for classification task for predict stage

Parameters
  • trained_operation – model object

  • predict_data (InputData) – data used for prediction

Returns

prediction target

Return type

OutputData

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) –

predict(trained_operation, predict_data)[source]

Predict method for classification task for predict stage

Parameters
  • trained_operation – model object

  • predict_data (InputData) – data used for prediction

Returns

prediction target

Return type

OutputData

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

OutputData

predict_for_fit(trained_operation, predict_data)[source]

Transform data for fit stage

Parameters
  • trained_operation – model object

  • predict_data (InputData) – data used for prediction

Returns

prediction target

Return type

OutputData

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]) –

predict(trained_operation, predict_data)[source]

Predict method for regression task for predict stage :param trained_operation: model object :param predict_data: data used for prediction :return:

Parameters

predict_data (InputData) –

Return type

OutputData

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

OutputData

predict_for_fit(trained_operation, predict_data)[source]

Transform method for preprocessing for fit stage

Parameters
  • trained_operation – model object

  • predict_data (InputData) – data used for prediction

Returns

Return type

OutputData

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

OutputData

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

OutputData

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

OutputData

predict_for_fit(trained_operation, predict_data)[source]

This method used for prediction of the target data during fit stage.

Parameters
  • trained_operation – trained operation object

  • predict_data (InputData) – data to predict

Return OutputData

passed data with new predicted target

Return type

OutputData

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

OutputData

predict_for_fit(trained_operation, predict_data)[source]

This method used for prediction of the target data during fit stage.

Parameters
  • trained_operation – trained operation object

  • predict_data (InputData) – data to predict

Return OutputData

passed data with new predicted target

Return type

OutputData

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

predict(trained_operation, predict_data)[source]

Predict method for clustering task :param trained_operation: operation object :param predict_data: data used for prediction

Parameters

predict_data (InputData) –

Return type

OutputData

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:

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

OutputData

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:

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

OutputData

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:

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

OutputData

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:

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

OutputData

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:

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

OutputData

static _convert_to_one_dim(array_with_text)[source]

Method converts array with text into one-dimensional list

Parameters

array_with_text – numpy array or list with text data

Return features_list

one-dimensional list with text

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

OutputData

predict_for_fit(trained_operation, predict_data)[source]

This method used for prediction of the target data during fit stage.

Parameters
  • trained_operation – trained operation object

  • predict_data (InputData) – data to predict

Return OutputData

passed data with new predicted target

Return type

OutputData

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

OutputData

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

OutputData

static _convert_to_one_dim(array_with_text)[source]

Method converts array with text into one-dimensional list

Parameters

array_with_text – numpy array or list with text data

Return features_list

one-dimensional list with text

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

fit(train_data)[source]

Fit method for custom strategy

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

OutputData

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

OutputData

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

OutputData

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]) –

predict(trained_operation, predict_data)[source]

Predict method for regression task for predict stage :param trained_operation: model object :param predict_data: data used for prediction :return:

Parameters

predict_data (InputData) –

Return type

OutputData

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]) –

predict(trained_operation, predict_data)[source]

Predict method for regression task for predict stage :param trained_operation: model object :param predict_data: data used for prediction :return:

Parameters

predict_data (InputData) –

Return type

OutputData

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

predict(trained_operation, predict_data)[source]

Predict method for regression task for predict stage :param trained_operation: model object :param predict_data: data used for prediction :return:

Parameters

predict_data (InputData) –

Return type

OutputData

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:

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

OutputData

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 repositories

    possible 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

OutputData

predict_for_fit(trained_operation, predict_data)[source]

Transform method for preprocessing task for fit stage

Parameters
  • trained_operation – model object

  • predict_data (InputData) – data used for prediction

Returns

Return type

OutputData