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: Method fills in the gaps in the input array using forward and inverse
  directions of predictions
  
  Args:
      input_data: data with gaps to filling in the gaps in it
  
  Returns:
      array without gaps
docstr_tok: ["Method","fills","in","the","gaps","in","the","input","array","using","forward","and","inverse","directions","of","predictions","Args",":","input_data",":","data","with","gaps","to","filling","in","the","gaps","in","it","Returns",":","array","without","gaps"]
code: def forward_inverse_filling(self, input_data):
      """Method fills in the gaps in the input array using forward and inverse
      directions of predictions
  
      Args:
          input_data: data with gaps to filling in the gaps in it
  
      Returns:
          array without gaps
      """
      output_data = np.array(input_data)
      output_data = replace_nan_with_label(
          output_data, label=self.gap_value
      )
      # Gap indices
      gap_list = np.ravel(np.argwhere(output_data == self.gap_value))
      new_gap_list = self._parse_gap_ids(gap_list)
  
      # Iteratively fill in the gaps in the time series
      for batch_index in range(len(new_gap_list)):
          preds = []
          weights = []
          # Two predictions are generated for each gap - forward and backward
          for direction_function in [self._forward, self._inverse]:
              weights_list, predicted_list = direction_function(
                  output_data, batch_index, new_gap_list
              )
              weights.append(weights_list)
              preds.append(predicted_list)
  
          preds = np.array(preds)
          weights = np.array(weights)
          result = np.average(preds, axis=0, weights=weights)
  
          gap = new_gap_list[batch_index]
          # Replace gaps in an array with prediction values
          output_data[gap] = result
  
      return output_data
  
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 2 for calling the ModelGapFiller obj's underlying member method code with example usage: obj.forward_inverse_filling(input_data) and returns: output_data