class_docstr: Base class used for filling in the gaps in time series with simple methods.
  Methods from the SimpleGapFiller class can be used for comparison with more
  complex models in class ModelGapFiller
  
  Args:
      gap_value: value, which identify gap elements in array
class_docstr_tok: ["Base","class","used","for","filling","in","the","gaps","in","time","series","with","simple","methods",".","Methods","from","the","SimpleGapFiller","class","can","be","used","for","comparison","with","more","complex","models","in","class","ModelGapFiller","Args",":","gap_value",":","value",",","which","identify","gap","elements","in","array"]
docstr: Method allows to restore missing values in an array
  using Savitzky-Golay filter
  
  Args:
      input_data: array with gaps
      degree: degree of a polynomial function
      n_neighbors: number of neighboring known elements of the time
      series that the approximation is based on
  
  Returns:
      array without gaps
docstr_tok: ["Method","allows","to","restore","missing","values","in","an","array","using","Savitzky-Golay","filter","Args",":","input_data",":","array","with","gaps","degree",":","degree","of","a","polynomial","function","n_neighbors",":","number","of","neighboring","known","elements","of","the","time","series","that","the","approximation","is","based","on","Returns",":","array","without","gaps"]
code: def local_poly_approximation(
      self, input_data, degree: int = 2, n_neighbors: int = 5
  ):
      """Method allows to restore missing values in an array
      using Savitzky-Golay filter
  
      Args:
          input_data: array with gaps
          degree: degree of a polynomial function
          n_neighbors: number of neighboring known elements of the time
          series that the approximation is based on
  
      Returns:
          array without gaps
      """
  
      output_data = np.array(input_data)
      output_data = replace_nan_with_label(
          output_data, label=self.gap_value
      )
  
      i_gaps = np.ravel(np.argwhere(output_data == self.gap_value))
  
      # Iterately fill in the gaps in the time series
      for gap_index in i_gaps:
          # Indexes of known elements (updated at each iteration)
          i_known = np.argwhere(output_data != self.gap_value)
          i_known = np.ravel(i_known)
  
          # Based on the indexes we calculate how far from the gap
          # the known values are located
          id_distances = np.abs(i_known - gap_index)
  
          # Now we know the indices of the smallest values in the array,
          # so sort indexes
          sorted_idx = np.argsort(id_distances)
          nearest_values = []
          nearest_indices = []
          for i in sorted_idx[:n_neighbors]:
              time_index = i_known[i]
              nearest_values.append(output_data[time_index])
              nearest_indices.append(time_index)
          nearest_values = np.array(nearest_values)
          nearest_indices = np.array(nearest_indices)
  
          local_coefs = np.polyfit(
              nearest_indices, nearest_values, degree
          )
          est_value = np.polyval(local_coefs, gap_index)
          output_data[gap_index] = est_value
  
      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 3 for calling the SimpleGapFiller obj's underlying member method code with example usage: obj.local_poly_approximation(input_data, degree, n_neighbors) and returns: output_data