code: def run_tuning_test(
      pipeline,
      train_input,
      predict_input,
      test_data,
      task,
      show_metrics=True,
  ):
      """
      Function for predicting values in a time series
  
      :param pipeline: TsForecastingPipeline object
      :param train_input: InputData for fit
      :param predict_input: InputData for predict
      :param test_data: numpy array for validation
      :param task: Ts_forecasting task
      :param show_metrics: is there need to print metrics before and after tuning
  
      :return amount_of_seconds time spent on tuning
      :return mae_before MAE metric of pipeline without tuning
      :return mae_after MAE metric of pipeline with tuning
      """
  
      pipeline.fit_from_scratch(train_input)
  
      # Predict
      predicted_values = pipeline.predict(predict_input)
      old_predicted_values = predicted_values.predict
      cv_folds = 3
  
      start_time = timeit.default_timer()
      pipeline_tuner = (
          TunerBuilder(task)
          .with_tuner(SimultaneousTuner)
          .with_metric(RegressionMetricsEnum.MAE)
          .with_cv_folds(cv_folds)
          .with_iterations(20)
          .build(train_input)
      )
      pipeline = pipeline_tuner.tune(pipeline)
      print(pipeline.print_structure())
      amount_of_seconds = timeit.default_timer() - start_time
      print(f"\nTuning pipline on {amount_of_seconds:.2f} seconds\n")
  
      # Fit pipeline on the entire train data
      pipeline.fit_from_scratch(train_input)
      # Predict
      predicted_values = pipeline.predict(predict_input)
      new_predicted_values = predicted_values.predict
      new_predicted_values = np.ravel(np.array(new_predicted_values))
      old_predicted_values = np.ravel(np.array(old_predicted_values))
  
      mae_before = mean_absolute_error(test_data, old_predicted_values)
      mae_after = mean_absolute_error(test_data, new_predicted_values)
  
      if show_metrics:
          print(f"MAE before tuning - {mae_before:.4f}")
          print(f"MAE after tuning - {mae_after:.4f}\n")
  
      return amount_of_seconds, mae_before, mae_after
  
file_path: FEDOT/examples/advanced/time_series_forecasting/sparse_lagged_tuning.py
imports: import os
  import timeit
  import warnings
  import matplotlib.pyplot
  import numpy
  import pandas
  from golem.core.tuning.simultaneous import SimultaneousTuner
  from sklearn.metrics import mean_absolute_error
  from examples.simple.time_series_forecasting.ts_pipelines import ts_complex_dtreg_pipeline
  from fedot.core.data.data import InputData
  from fedot.core.pipelines.tuning.tuner_builder import TunerBuilder
  from fedot.core.repository.dataset_types import DataTypesEnum
  from fedot.core.repository.metrics_repository import RegressionMetricsEnum
  from fedot.core.repository.tasks import Task, TaskTypesEnum, TsForecastingParams
  from fedot.core.utils import fedot_project_root
label_desc: Use image node_id 2 for calling a global function with example usage: run_tuning_test(pipeline, train_input, predict_input, test_data, task, show_metrics) and returns: amount_of_seconds,  mae_before,  mae_after