Evaluation Strategy¶
-
class
fedot.core.operations.evaluation.evaluation_interfaces.
EvaluationStrategy
(operation_type, params=None, log=None)¶ Bases:
object
Base class to define the evaluation strategy of Operation object: the certain sklearn or any other operation with fit/predict methods. :param operation_type: str type of the operation defined in operation repository :param dict params: hyperparameters to fit the operation with :param Log log: Log object to record messages
- Parameters
operation_type (str) –
params (Optional[dict]) –
log (Optional[fedot.core.log.Log]) –
-
property
operation_type
¶
-
abstract
fit
(train_data)¶ Main method to train the operation with the data provided :param InputData train_data: data used for operation training :return:
- Parameters
train_data (fedot.core.data.data.InputData) –
-
abstract
predict
(trained_operation, predict_data, is_fit_pipeline_stage)¶ Main method to predict the target data. :param trained_operation: trained operation object :param InputData predict_data: data to predict :param is_fit_pipeline_stage: is this fit or predict stage for pipeline :return OutputData: passed data with new predicted target
- Parameters
predict_data (fedot.core.data.data.InputData) –
is_fit_pipeline_stage (bool) –
- Return type
-
property
implementation_info
¶
-
class
fedot.core.operations.evaluation.evaluation_interfaces.
SkLearnEvaluationStrategy
(operation_type, params=None)¶ Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
This class defines the certain operation implementation for the sklearn 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)¶ This method is used for operation training with the data provided :param InputData train_data: data used for operation training :return: trained Sklearn operation
- Parameters
train_data (fedot.core.data.data.InputData) –
-
predict
(trained_operation, predict_data, is_fit_pipeline_stage)¶ This method used for prediction of the target data. :param trained_operation: operation object :param predict_data: data to predict :param is_fit_pipeline_stage: is this fit or predict stage for pipeline :return OutputData: passed data with new predicted target
- Parameters
predict_data (fedot.core.data.data.InputData) –
is_fit_pipeline_stage (bool) –
- Return type
-
property
implementation_info
¶
-
fedot.core.operations.evaluation.evaluation_interfaces.
convert_to_multivariate_model
(sklearn_model, train_data)¶ 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 train
train_data (fedot.core.data.data.InputData) – data used for model training
:return : wrapped Sklearn model
-
fedot.core.operations.evaluation.evaluation_interfaces.
is_multi_output_task
(train_data)¶
Preprocessing¶
-
class
fedot.core.operations.evaluation.common_preprocessing.
FedotPreprocessingStrategy
(operation_type, params=None)¶ Bases:
fedot.core.operations.evaluation.evaluation_interfaces.EvaluationStrategy
- Parameters
operation_type (str) –
params (Optional[dict]) –
-
fit
(train_data)¶ This method is used for operation training with the data provided :param InputData train_data: data used for operation training :return: trained Sklearn operation
- Parameters
train_data (fedot.core.data.data.InputData) –
-
predict
(trained_operation, predict_data, is_fit_pipeline_stage)¶ Transform method for preprocessing task
- Parameters
trained_operation – model object
predict_data (fedot.core.data.data.InputData) – data used for prediction
is_fit_pipeline_stage (bool) – is this fit or predict stage for pipeline
- Returns
Sklearn Transformation¶
-
class
fedot.core.operations.evaluation.operation_implementations.data_operations.sklearn_transformations.
ComponentAnalysisImplementation
(**params)¶ Bases:
fedot.core.operations.evaluation.operation_implementations.implementation_interfaces.DataOperationImplementation
Class for applying PCA and kernel PCA models form sklearn
- Parameters
params (Optional[dict]) – optional, dictionary with the arguments
-
fit
(input_data)¶ The method trains the PCA model
- Parameters
input_data – data with features, target and ids for PCA training
- Return pca
trained PCA model (optional output)
-
transform
(input_data, is_fit_pipeline_stage)¶ Method for transformation tabular data using PCA
- Parameters
input_data – data with features, target and ids for PCA applying
is_fit_pipeline_stage (Optional[bool]) – is this fit or predict stage for pipeline
- Return input_data
data with transformed features attribute
-
check_and_correct_params
()¶ Method check if number of features in data enough for n_components parameter in PCA or not. And if not enough - fixes it
-
get_params
()¶ Method return parameters, which can be optimized for particular operation
-
static
update_column_types
(output_data)¶ Update column types after applying PCA operations
- Parameters
output_data (fedot.core.data.data.OutputData) –
-
class
fedot.core.operations.evaluation.operation_implementations.data_operations.sklearn_transformations.
PCAImplementation
(**params)¶ -
Class for applying PCA from sklearn
- Parameters
params (Optional[dict]) – optional, dictionary with the hyperparameters
-
class
fedot.core.operations.evaluation.operation_implementations.data_operations.sklearn_transformations.
KernelPCAImplementation
(**params)¶ -
Class for applying kernel PCA from sklearn
- Parameters
params (Optional[dict]) – optional, dictionary with the hyperparameters
-
class
fedot.core.operations.evaluation.operation_implementations.data_operations.sklearn_transformations.
FastICAImplementation
(**params)¶ -
Class for applying FastICA from sklearn
- Parameters
params (Optional[dict]) – optional, dictionary with the hyperparameters
-
class
fedot.core.operations.evaluation.operation_implementations.data_operations.sklearn_transformations.
PolyFeaturesImplementation
(**params)¶ Bases:
fedot.core.operations.evaluation.operation_implementations.implementation_interfaces.EncodedInvariantImplementation
Class for application of PolynomialFeatures operation on data, where only not encoded features (were not converted from categorical using OneHot encoding) are used
- Parameters
params (Optional[dict]) – optional, dictionary with the arguments
-
fit
(input_data)¶ Method for fit Poly features operation
-
transform
(input_data, is_fit_pipeline_stage)¶ Firstly perform filtration of columns
- Parameters
is_fit_pipeline_stage (Optional[bool]) –
-
get_params
()¶ Method return parameters, which can be optimized for particular operation
-
class
fedot.core.operations.evaluation.operation_implementations.data_operations.sklearn_transformations.
ScalingImplementation
(**params)¶ Bases:
fedot.core.operations.evaluation.operation_implementations.implementation_interfaces.EncodedInvariantImplementation
Class for application of Scaling operation on data, where only not encoded features (were not converted from categorical using OneHot encoding) are used
- Parameters
params (Optional[dict]) – optional, dictionary with the arguments
-
get_params
()¶ Method return parameters, which can be optimized for particular operation
-
class
fedot.core.operations.evaluation.operation_implementations.data_operations.sklearn_transformations.
NormalizationImplementation
(**params)¶ Bases:
fedot.core.operations.evaluation.operation_implementations.implementation_interfaces.EncodedInvariantImplementation
Class for application of MinMax normalization operation on data, where only not encoded features (were not converted from categorical using OneHot encoding) are used
- Parameters
params (Optional[dict]) – optional, dictionary with the arguments
-
get_params
()¶ Method return parameters, which can be optimized for particular operation
-
class
fedot.core.operations.evaluation.operation_implementations.data_operations.sklearn_transformations.
ImputationImplementation
(**params)¶ Bases:
fedot.core.operations.evaluation.operation_implementations.implementation_interfaces.DataOperationImplementation
Class for applying imputation on tabular data
- Parameters
params (Optional[dict]) – optional, dictionary with the arguments
-
fit
(input_data)¶ The method trains SimpleImputer
- Parameters
input_data (fedot.core.data.data.InputData) – data with features
-
transform
(input_data, is_fit_pipeline_stage=None)¶ Method for transformation tabular data using SimpleImputer
- Parameters
input_data – data with features
is_fit_pipeline_stage (Optional[bool]) – is this fit or predict stage for pipeline
- Return input_data
data with transformed features attribute
-
fit_transform
(input_data, is_fit_pipeline_stage=None)¶ Method for training and transformation tabular data using SimpleImputer
- Parameters
input_data – data with features
is_fit_pipeline_stage (Optional[bool]) – is this fit or predict stage for pipeline
- Return input_data
data with transformed features attribute
-
get_params
()¶ Method return parameters, which can be optimized for particular operation
- Return type
dict
Time Series Transformation¶
-
class
fedot.core.operations.evaluation.operation_implementations.data_operations.ts_transformations.
LaggedImplementation
(log=None, **params)¶ Bases:
fedot.core.operations.evaluation.operation_implementations.implementation_interfaces.DataOperationImplementation
- Parameters
log (Optional[fedot.core.log.Log]) –
-
fit
(input_data)¶ Class doesn’t support fit operation
- Parameters
input_data – data with features, target and ids to process
-
transform
(input_data, is_fit_pipeline_stage)¶ Method for transformation of time series to lagged form
- Parameters
input_data – data with features, target and ids to process
is_fit_pipeline_stage (bool) – is this fit or predict stage for pipeline
- Return output_data
output data with transformed features table
-
stack_by_type_fit
(input_data, all_features, all_target, all_idx, features, target, idx)¶ Apply stack function for multi_ts and multivariable ts types on fit step
-
stack_by_type_predict
(input_data, all_features, part_to_add)¶ Apply stack function for multi_ts and multivariable ts types on predict step
-
class
fedot.core.operations.evaluation.operation_implementations.data_operations.ts_transformations.
SparseLaggedTransformationImplementation
(**params)¶ -
Implementation of sparse lagged transformation for time series forecasting
-
get_params
()¶ Method return parameters, which can be optimized for particular operation
-
-
class
fedot.core.operations.evaluation.operation_implementations.data_operations.ts_transformations.
LaggedTransformationImplementation
(**params)¶ -
Implementation of lagged transformation for time series forecasting
-
get_params
()¶ Method return parameters, which can be optimized for particular operation
-
-
class
fedot.core.operations.evaluation.operation_implementations.data_operations.ts_transformations.
TsSmoothingImplementation
(**params)¶ Bases:
fedot.core.operations.evaluation.operation_implementations.implementation_interfaces.DataOperationImplementation
-
fit
(input_data)¶ Class doesn’t support fit operation
- Parameters
input_data – data with features, target and ids to process
-
transform
(input_data, is_fit_pipeline_stage)¶ Method for smoothing time series
- Parameters
input_data (fedot.core.data.data.InputData) – data with features, target and ids to process
is_fit_pipeline_stage (bool) – is this fit or predict stage for pipeline
- Return output_data
output data with smoothed time series
-
get_params
()¶ Method return parameters, which can be optimized for particular operation
-
-
class
fedot.core.operations.evaluation.operation_implementations.data_operations.ts_transformations.
ExogDataTransformationImplementation
(**params)¶ Bases:
fedot.core.operations.evaluation.operation_implementations.implementation_interfaces.DataOperationImplementation
-
fit
(input_data)¶ Class doesn’t support fit operation
- Parameters
input_data – data with features, target and ids to process
-
transform
(input_data, is_fit_pipeline_stage)¶ Method for representing time series as column
- Parameters
input_data – data with features, target and ids to process
is_fit_pipeline_stage (bool) – is this fit or predict stage for pipeline
- Return output_data
output data with features as columns
-
get_params
()¶ Method return parameters, which can be optimized for particular operation
-
-
class
fedot.core.operations.evaluation.operation_implementations.data_operations.ts_transformations.
GaussianFilterImplementation
(**params)¶ Bases:
fedot.core.operations.evaluation.operation_implementations.implementation_interfaces.DataOperationImplementation
-
fit
(input_data)¶ Class doesn’t support fit operation
- Parameters
input_data – data with features, target and ids to process
-
transform
(input_data, is_fit_pipeline_stage)¶ Method for smoothing time series
- Parameters
input_data (fedot.core.data.data.InputData) – data with features, target and ids to process
is_fit_pipeline_stage (bool) – is this fit or predict stage for pipeline
- Return output_data
output data with smoothed time series
-
get_params
()¶ Method return parameters, which can be optimized for particular operation
-
-
class
fedot.core.operations.evaluation.operation_implementations.data_operations.ts_transformations.
NumericalDerivativeFilterImplementation
(log=None, **params)¶ Bases:
fedot.core.operations.evaluation.operation_implementations.implementation_interfaces.DataOperationImplementation
- Parameters
log (Optional[fedot.core.log.Log]) –
-
fit
(input_data)¶ Class doesn’t support fit operation
- Parameters
input_data – data with features, target and ids to process
-
transform
(input_data, is_fit_pipeline_stage)¶ Method for finding numerical derivative of time series
- Parameters
input_data (fedot.core.data.data.InputData) – data with features, target and ids to process
is_fit_pipeline_stage (bool) – is this fit or predict stage for pipeline
- Return output_data
output data with smoothed time series
-
get_params
()¶ Method return parameters, which can be optimized for particular operation
-
class
fedot.core.operations.evaluation.operation_implementations.data_operations.ts_transformations.
CutImplementation
(log=None, **params)¶ Bases:
fedot.core.operations.evaluation.operation_implementations.implementation_interfaces.DataOperationImplementation
- Parameters
log (Optional[fedot.core.log.Log]) –
-
fit
(input_data)¶ Class doesn’t support fit operation
- Parameters
input_data (fedot.core.data.data.InputData) – data with features, target and ids to process
-
transform
(input_data, is_fit_pipeline_stage)¶ Cut first cut_part from time series new_len = len - int(self.cut_part * (input_values.shape[0]-horizon))
- Parameters
input_data (fedot.core.data.data.InputData) – data with features, target and ids to process
is_fit_pipeline_stage (Optional[bool]) – is this fit or predict stage for pipeline
- Return output_data
output data with cutted time series
- Return type
-
get_params
()¶ Method return parameters, which can be optimized for particular operation
-
fedot.core.operations.evaluation.operation_implementations.data_operations.ts_transformations.
ts_to_table
(idx, time_series, window_size, is_lag=False)¶ Method convert time series to lagged form.
- Parameters
idx – the indices of the time series to convert
time_series (numpy.array) – source time series
window_size (int) – size of sliding window, which defines lag
is_lag – is function used for lagged transformation.
False needs to convert one dimensional output to lagged form.
- Return updated_idx
clipped indices of time series
- Return features_columns
lagged time series feature table
- Parameters
time_series (numpy.array) –
window_size (int) –
-
fedot.core.operations.evaluation.operation_implementations.data_operations.ts_transformations.
prepare_target
(all_idx, idx, features_columns, target, forecast_length)¶ Method convert time series to lagged form. Transformation applied only for generating target table (time series considering as multi-target regression task).
- Parameters
all_idx – all indices in data
idx – remaining indices after lagged feature table generation
features_columns (numpy.array) – lagged feature table
target – source time series
forecast_length (int) – forecast length
- Return updated_idx
clipped indices of time series
- Return updated_features
clipped lagged feature table
- Return updated_target
lagged target table