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 maximizes the subsequence unsupervised similarity score (SUSS). It is
  based on the assumption that the window size that best captures the periodicity of the time series is the one
  that maximizes the similarity between subsequences of the time series.
docstr_tok: ["Method","to","find","the","window","size","that","maximizes","the","subsequence","unsupervised","similarity","score","(","SUSS",")",".","It","is","based","on","the","assumption","that","the","window","size","that","best","captures","the","periodicity","of","the","time","series","is","the","one","that","maximizes","the","similarity","between","subsequences","of","the","time","series","."]
code: def summary_statistics_subsequence(
      self, time_series: np.array, threshold=0.89
  ) -> int:
      """Method to find the window size that maximizes the subsequence unsupervised similarity score (SUSS). It is
      based on the assumption that the window size that best captures the periodicity of the time series is the one
      that maximizes the similarity between subsequences of the time series.
      """
      # lbound = self.window_min
      time_series = (time_series - time_series.min()) / (
          time_series.max() - time_series.min()
      )
  
      ts_mean = np.mean(time_series)
      ts_std = np.std(time_series)
      ts_min_max = np.max(time_series) - np.min(time_series)
  
      stats = (ts_mean, ts_std, ts_min_max)
  
      max_score = self.suss_score(
          time_series=time_series, window_size=1, stats=stats
      )
      min_score = self.suss_score(
          time_series=time_series,
          window_size=time_series.shape[0] - 1,
          stats=stats,
      )
  
      exp = 0
  
      # exponential search (to find window size interval)
      while True:
          window_size = 2**exp
  
          if window_size > self.window_max:
              break
  
          if window_size < self.window_min:
              exp += 1
              continue
  
          score = 1 - (
              self.suss_score(time_series, window_size, stats)
              - min_score
          ) / (max_score - min_score)
  
          if score > threshold:
              break
  
          exp += 1
  
      lbound, ubound = (
          max(self.window_min, 2 ** (exp - 1)),
          2**exp + 1,
      )
  
      # binary search (to find window size in interval)
      while lbound <= ubound:
          window_size = int((lbound + ubound) / 2)
          score = 1 - (
              self.suss_score(time_series, window_size, stats)
              - min_score
          ) / (max_score - min_score)
  
          if score < threshold:
              lbound = window_size + 1
          elif score > threshold:
              ubound = window_size - 1
          else:
              break
  
      return 2 * lbound
  
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 8 for calling the WindowSizeSelector obj's underlying member method code with example usage: obj.summary_statistics_subsequence(time_series, threshold) and returns: unknown