class_docstr: Class used for filling in the gaps in time series
  
  Args:
      gap_value: value, which mask gap elements in array
      pipeline: TsForecastingPipeline object for filling in the gaps
class_docstr_tok: ["Class","used","for","filling","in","the","gaps","in","time","series","Args",":","gap_value",":","value",",","which","mask","gap","elements","in","array","pipeline",":","TsForecastingPipeline","object","for","filling","in","the","gaps"]
docstr: The time series method makes an inverse forecast based on the part
  of the time series that is located to the right of the gap.
  
  Args:
      output_data: one-dimensional array of a time series
      batch_index: index of the interval (batch) with a gap
      new_gap_list: array with nested lists of gap indexes
  
  Returns:
      weights_list: numpy array with prediction weights for averaging
      predicted_values: numpy array with prediction values in the gap
docstr_tok: ["The","time","series","method","makes","an","inverse","forecast","based","on","the","part","of","the","time","series","that","is","located","to","the","right","of","the","gap",".","Args",":","output_data",":","one-dimensional","array","of","a","time","series","batch_index",":","index","of","the","interval","(","batch",")","with","a","gap","new_gap_list",":","array","with","nested","lists","of","gap","indexes","Returns",":","weights_list",":","numpy","array","with","prediction","weights","for","averaging","predicted_values",":","numpy","array","with","prediction","values","in","the","gap"]
code: def _inverse(self, output_data, batch_index, new_gap_list):
      """The time series method makes an inverse forecast based on the part
      of the time series that is located to the right of the gap.
  
      Args:
          output_data: one-dimensional array of a time series
          batch_index: index of the interval (batch) with a gap
          new_gap_list: array with nested lists of gap indexes
  
      Returns:
          weights_list: numpy array with prediction weights for averaging
          predicted_values: numpy array with prediction values in the gap
      """
  
      gap = new_gap_list[batch_index]
      # Adaptive prediction interval length
      len_gap = len(gap)
      weights_list = np.arange(1, (len_gap + 1), 1)
  
      first_gap_element_id = gap[0]
      latest_gap_element_id = gap[-1]
      if batch_index == len(new_gap_list) - 1:
          # If the interval with a gap is the last one in the array
          timeseries_train_part = output_data[
              (latest_gap_element_id + 1) :
          ]
  
          is_gap_in_end_time_series = len(timeseries_train_part) == 0
          is_series_size_not_enough = (
              len(timeseries_train_part) - len_gap
          ) < self.min_train_ts_length
          if is_gap_in_end_time_series:
              # The gap is last element - take last observed value as predicted
              last_known_value = output_data[first_gap_element_id - 1]
              return weights_list, [last_known_value] * len_gap
          elif is_series_size_not_enough:
              # Number of elements in time series after gap is not enough for
              # model training - interpolation is required
              last_known_value_id = (
                  first_gap_element_id - 1
                  if first_gap_element_id > 0
                  else 0
              )
              extended_part = output_data[last_known_value_id:]
      else:
          # Next gap interval is exist
          next_gap = new_gap_list[batch_index + 1]
          timeseries_train_part = output_data[
              (latest_gap_element_id + 1) : next_gap[0]
          ]
  
          # Take part with known values to the left from the gap
          extended_part = output_data[
              (first_gap_element_id - 1) : next_gap[0]
          ]
  
          if first_gap_element_id == 0:
              # Gap in the first part of time series - take first observed value
              first_known_value = timeseries_train_part[0]
              return weights_list, [first_known_value] * len_gap
      timeseries_train_part = np.flip(timeseries_train_part)
  
      train_ts_len = len(timeseries_train_part) - len_gap
      if train_ts_len < self.min_train_ts_length:
          interpolated_part = self.linear_interpolation(extended_part)
          # Clip pre-history
          interpolated_part = interpolated_part[1:]
          # Clip parts after gap interval
          predicted = interpolated_part[:len_gap]
      else:
          predicted = self.__pipeline_fit_predict(
              self.pipeline, timeseries_train_part, len_gap
          )
  
          predicted = np.flip(predicted)
      return weights_list, predicted
  
imports: from copy import deepcopy
  from typing import List, Union
  import numpy
  from golem.core.log import default_log
  from scipy import interpolate
  from fedot.core.data.data import InputData
  from fedot.core.repository.dataset_types import DataTypesEnum
  from fedot.core.repository.tasks import Task, TaskTypesEnum, TsForecastingParams
label_desc: Use image node_id 5 for calling the ModelGapFiller obj's underlying member method code with example usage: obj._inverse(output_data, batch_index, new_gap_list) and returns: weights_list,  predicted, weights_list,  unknown, weights_list,  unknown