code: def in_sample_fitted_values(
      source_input: InputData, train_predicted: OutputData
  ) -> OutputData:
      """Perform in sample validation based on training sample"""
      forecast_length = train_predicted.task.task_params.forecast_length
      all_values = []
      step = 0
      # Glues together parts of predictions using "in-sample" way
      while step < len(train_predicted.predict):
          all_values.extend(train_predicted.predict[step, :])
          step += forecast_length
  
      # In some cases it doesn't reach the end
      if not np.isclose(
          all_values[-1], train_predicted.predict[-1, -1]
      ):
          missing_part_index = step - len(train_predicted.predict) + 1
          # Store missing predicted values
          all_values.extend(
              train_predicted.predict[-1, missing_part_index:]
          )
  
      copied_data = copy(train_predicted)
      copied_data.predict = np.array(all_values)
      # Update indices
      first_id = copied_data.idx[0]
      if isinstance(first_id, str):
          indices_range = generate_ids(
              source_input, copied_data, expand=True
          )
          copied_data.idx = indices_range[:-1]
      else:
          copied_data.idx = np.arange(
              first_id, first_id + len(all_values)
          )
  
      return copied_data
  
file_path: FEDOT/fedot/core/pipelines/ts_wrappers.py
imports: import math
  from copy import copy
  from typing import Union, Optional
  import numpy
  from fedot.core.data.data import InputData, OutputData
  from fedot.core.data.multi_modal import MultiModalData
  from fedot.core.operations.evaluation.operation_implementations.data_operations.ts_transformations import ts_to_table
  from fedot.core.pipelines.pipeline import Pipeline
  from fedot.core.repository.dataset_types import DataTypesEnum
  from fedot.core.repository.tasks import TaskTypesEnum
label_desc: Use image node_id 4 for calling a global function with example usage: in_sample_fitted_values(source_input, train_predicted) and returns: copied_data