class_docstr: Class for selecting optimal data processing strategies based on type of data.
  Available data sources are:
      * numpy array
      * pandas DataFrame
      * string (path to csv file)
      * InputData (FEDOT dataclass)
  
  Data preprocessing such a class performing also
class_docstr_tok: ["Class","for","selecting","optimal","data","processing","strategies","based","on","type","of","data",".","Available","data","sources","are",":","*","numpy","array","*","pandas","DataFrame","*","string","(","path","to","csv","file",")","*","InputData","(","FEDOT","dataclass",")","Data","preprocessing","such","a","class","performing","also"]
docstr: Prepare predictions 
docstr_tok: ["Prepare","predictions"]
code: def define_predictions(
      self,
      current_pipeline: Pipeline,
      test_data: Union[InputData, MultiModalData],
      in_sample: bool = False,
      validation_blocks: int = None,
  ) -> OutputData:
      """Prepare predictions"""
      if self.task.task_type == TaskTypesEnum.classification:
          # Prediction should be converted into source labels
          output_prediction = current_pipeline.predict(
              test_data, output_mode="labels"
          )
      elif self.task.task_type == TaskTypesEnum.ts_forecasting:
          if in_sample:
              forecast_length = (
                  test_data.task.task_params.forecast_length
              )
              validation_blocks = validation_blocks or 1
              horizon = forecast_length * validation_blocks
              forecast = in_sample_ts_forecast(
                  current_pipeline, test_data, horizon
              )
              idx = test_data.idx[-horizon:]
              prediction = convert_forecast_to_output(
                  test_data, forecast, idx=idx
              )
          else:
              prediction = current_pipeline.predict(test_data)
              # Convert forecast into one-dimensional array
              forecast = np.ravel(np.array(prediction.predict))
              prediction.predict = forecast
          output_prediction = prediction
      else:
          output_prediction = current_pipeline.predict(test_data)
  
      return output_prediction
  
imports: import sys
  from datetime import datetime
  from typing import Dict, Union
  from typing import Optional
  import numpy
  from golem.core.log import default_log
  from fedot.api.api_utils.data_definition import data_strategy_selector, FeaturesType, TargetType
  from fedot.core.data.data import InputData, OutputData, data_type_is_table
  from fedot.core.data.data_preprocessing import convert_into_column
  from fedot.core.data.multi_modal import MultiModalData
  from fedot.core.pipelines.pipeline import Pipeline
  from fedot.core.pipelines.ts_wrappers import in_sample_ts_forecast, convert_forecast_to_output
  from fedot.core.repository.tasks import Task, TaskTypesEnum
  from fedot.core.utils import convert_memory_size
  from fedot.preprocessing.dummy_preprocessing import DummyPreprocessor
  from fedot.preprocessing.preprocessing import DataPreprocessor
label_desc: Use image node_id 3 for calling the ApiDataProcessor obj's underlying member method code with example usage: obj.define_predictions(current_pipeline, test_data, in_sample, validation_blocks) and returns: output_prediction