code: def smoothing_window(data, window=[1, 1, 1]):
      
      
      for i in range(len(data) - sum(window)):
          
          start_window_from = i
          start_window_to = i+window[0]
  
          end_window_from = start_window_to + window[1]
          end_window_to = end_window_from + window[2]
  
          if np.all(data[start_window_from: start_window_to] == data[end_window_from: end_window_to]):
              data[start_window_from: end_window_to] = data[start_window_from]
              
      return data
docs: This is a smoothing functionality so we can fix misclassifications.
          It will run a sliding window of form [border, smoothing, border] on the
          signal and if the border elements are the same it will change the 
          smooth elements to match the border. An example would be for a window
          of [2, 1, 2] we have the following elements [1, 1, 0, 1, 1], this will
          transform it into [1, 1, 1, 1, 1]. So if the border elements match it
          will transform the middle (smoothing) into the same as the border.
          
          :param data array: One-dimensional array.
          :param window array: Used to define the [border, smoothing, border]
                               regions.
                               
          :return data array: The smoothed version of the original data.