class_docstr: Class to select appropriate window size to catch periodicity for time series analysis.
  There are two group of algorithms implemented:
  Whole-Series-Based (WSB):
      1. WindowSizeSelectorMethodsEnum.HAC - highest_autocorrelation
      2. WindowSizeSelectorMethodsEnum.DFF - dominant_fourier_frequency
  Subsequence-based (SB):
      1. WindowSizeSelectorMethodsEnum.MWF - multi_window_finder
      2. WindowSizeSelectorMethodsEnum.SSS - summary_statistics_subsequence
  Args:
      method: by ``default``, it is WindowSizeSelectorMethodsEnum.DFF.
      window_range: % of time series length, by ``default`` it is (5, 50).
  Attributes:
      length_ts(int): length of the time_series.
      window_max(int): maximum window size in real values.
      window_min(int): minimum window size in real values.
      dict_methods(dict): dictionary with all implemented methods.
  Example:
      To find window size for single time series::
          ts = np.random.rand(1000)
          ws_selector = WindowSizeSelector(method='hac')
          window_size = ws_selector.get_window_size(time_series=ts)
      To find window size for multiple time series::
          ts = np.random.rand(1000, 10)
          ws_selector = WindowSizeSelector(method='hac')
          window_size = ws_selector.apply(time_series=ts, average='median')
  Reference:
      (c) "Windows Size Selection in Unsupervised Time Series Analytics: A Review and Benchmark. Arik Ermshaus,
      Patrick Schafer, and Ulf Leser. 2022"
class_docstr_tok: ["Class","to","select","appropriate","window","size","to","catch","periodicity","for","time","series","analysis",".","There","are","two","group","of","algorithms","implemented",":","Whole-Series-Based","(","WSB",")",":","1",".","WindowSizeSelectorMethodsEnum.HAC","-","highest_autocorrelation","2",".","WindowSizeSelectorMethodsEnum.DFF","-","dominant_fourier_frequency","Subsequence-based","(","SB",")",":","1",".","WindowSizeSelectorMethodsEnum.MWF","-","multi_window_finder","2",".","WindowSizeSelectorMethodsEnum.SSS","-","summary_statistics_subsequence","Args",":","method",":","by","``","default","``",",","it","is","WindowSizeSelectorMethodsEnum.DFF",".","window_range",":","%","of","time","series","length",",","by","``","default","``","it","is","(","5",",","50",")",".","Attributes",":","length_ts","(","int",")",":","length","of","the","time_series",".","window_max","(","int",")",":","maximum","window","size","in","real","values",".","window_min","(","int",")",":","minimum","window","size","in","real","values",".","dict_methods","(","dict",")",":","dictionary","with","all","implemented","methods",".","Example",":","To","find","window","size","for","single","time","series",":",":","ts","=","np.random.rand","(","1000",")","ws_selector","=","WindowSizeSelector","(","method='hac","'",")","window_size","=","ws_selector.get_window_size","(","time_series=ts",")","To","find","window","size","for","multiple","time","series",":",":","ts","=","np.random.rand","(","1000",",","10",")","ws_selector","=","WindowSizeSelector","(","method='hac","'",")","window_size","=","ws_selector.apply","(","time_series=ts",",","average='median","'",")","Reference",":","(","c",")","``","Windows","Size","Selection","in","Unsupervised","Time","Series","Analytics",":","A","Review","and","Benchmark",".","Arik","Ermshaus",",","Patrick","Schafer",",","and","Ulf","Leser",".","2022","''"]
docstr: Method to find the window size that minimizes the moving average residual. It is based on the assumption
  that the window size that best captures the periodicity of the time series is the one that minimizes the
  difference between the moving average and the time series.
docstr_tok: ["Method","to","find","the","window","size","that","minimizes","the","moving","average","residual",".","It","is","based","on","the","assumption","that","the","window","size","that","best","captures","the","periodicity","of","the","time","series","is","the","one","that","minimizes","the","difference","between","the","moving","average","and","the","time","series","."]
code: def mwf(self, time_series: np.array) -> int:
      """Method to find the window size that minimizes the moving average residual. It is based on the assumption
      that the window size that best captures the periodicity of the time series is the one that minimizes the
      difference between the moving average and the time series.
      """
  
      all_averages, window_sizes = [], []
  
      for w in range(self.window_min, self.window_max, 1):
          movingAvg = np.array(self.movmean(time_series, w))
          all_averages.append(movingAvg)
          window_sizes.append(w)
  
      movingAvgResiduals = []
  
      for i, w in enumerate(window_sizes):
          moving_avg = all_averages[i][: len(all_averages[-1])]
          movingAvgResidual = np.log(
              abs(moving_avg - (moving_avg).mean()).sum()
          )
          movingAvgResiduals.append(movingAvgResidual)
  
      b = (np.diff(np.sign(np.diff(movingAvgResiduals))) > 0).nonzero()[
          0
      ] + 1  # local min
  
      if len(b) == 0:
          return self.window_min
      if len(b) < 3:
          return window_sizes[b[0]]
  
      reswin = np.array(
          [window_sizes[b[i]] / (i + 1) for i in range(3)]
      )
      w = np.mean(reswin)
  
      return int(w)
  
file_path: FEDOT/fedot/utilities/window_size_selector.py
imports: import math
  from enum import Enum, auto
  import numpy
  import pandas
  from scipy.signal import find_peaks
  from statsmodels.tsa.stattools import acf
label_desc: Use image node_id 6 for calling the WindowSizeSelector obj's underlying member method code with example usage: obj.mwf(time_series) and returns: int, self, window_sizes