Pipeline

class fedot.core.pipelines.pipeline.Pipeline(nodes=None, log=None)

Bases: fedot.core.dag.graph.Graph

Base class used for composite model structure definition

Parameters
fit_from_scratch(input_data=None)

[Obsolete] Method used for training the pipeline without using saved information

Parameters

input_data (Union[fedot.core.data.data.InputData, fedot.core.data.multi_modal.MultiModalData]) – data used for operation training

fit(input_data, use_fitted=False, time_constraint=None, n_jobs=1)

Run training process in all nodes in pipeline starting with root.

Parameters
  • input_data (Union[fedot.core.data.data.InputData, fedot.core.data.multi_modal.MultiModalData]) – data used for operation training

  • use_fitted – flag defining whether use saved information about previous fits or not

  • time_constraint (Optional[datetime.timedelta]) – time constraint for operation fitting (seconds)

  • n_jobs – number of threads for nodes fitting

Return type

fedot.core.data.data.OutputData

property is_fitted
unfit(mode='all', unfit_preprocessor=True)

Remove fitted operations for all nodes.

Parameters
  • mode

    • ‘all’ - All models will be unfitted

    • ’data_operations’ - All data operations will be unfitted

  • unfit_preprocessor (bool) – should we unfit preprocessor

fit_from_cache(cache, fold_num=None)
Parameters
  • cache (Optional[fedot.core.composer.cache.OperationsCache]) –

  • fold_num (Optional[int]) –

Return type

bool

predict(input_data, output_mode='default')

Run the predict process in all nodes in pipeline starting with root.

Parameters
  • input_data (Union[fedot.core.data.data.InputData, fedot.core.data.multi_modal.MultiModalData]) – data for prediction

  • output_mode (str) – desired form of output for operations. Available options are: ‘default’ (as is), ‘labels’ (numbers of classes - for classification) , ‘probs’ (probabilities - for classification == ‘default’), ‘full_probs’ (return all probabilities - for binary classification).

Returns

OutputData with prediction

Return type

fedot.core.data.data.OutputData

fine_tune_all_nodes(loss_function, loss_params=None, input_data=None, iterations=50, timeout=5, cv_folds=None, validation_blocks=3)
Tune all hyperparameters of nodes simultaneously via black-box

optimization using PipelineTuner. For details, see

tune_pipeline()

Parameters
  • loss_function (Callable) –

  • loss_params (dict) –

  • fedot.core.data.multi_modal.MultiModalData] input_data (Union[fedot.core.data.data.InputData,) –

  • timeout (Optional[float]) –

  • cv_folds (int) –

  • validation_blocks (int) –

Return type

fedot.core.pipelines.pipeline.Pipeline

save(path=None, datetime_in_path=True)

Save the pipeline to the json representation with pickled fitted operations.

:param path to json file with operation :param datetime_in_path flag for addition of the datetime stamp to saving path :return: json containing a composite operation description

Parameters
  • path (str) –

  • datetime_in_path (bool) –

Return type

Tuple[str, dict]

load(source, dict_fitted_operations=None)

Load the pipeline the json representation with pickled fitted operations.

:param source path to json file with operation :param dict_fitted_operations dictionary of the fitted operations

Parameters
  • dict] source (Union[str,) –

  • dict_fitted_operations (dict) –

property root_node
pipeline_for_side_task(task_type)

Method returns pipeline formed from the last node solving the given problem and all its parents

Parameters

task_type (fedot.core.repository.tasks.TaskTypesEnum) – task type last node to search for

Returns

pipeline formed from the last node solving the given problem and all its parents

Return type

fedot.core.pipelines.pipeline.Pipeline

print_structure()

Method print information about pipeline

fedot.core.pipelines.pipeline.nodes_with_operation(pipeline, operation_name)

The function return list with nodes with the needed operation

Parameters
Return type

list

:return : list with nodes, None if there are no nodes