code: def seasonality_test(
      past_ts_data: np.ndarray, season_length: int
  ) -> bool:
      """
      Test the time series for seasonal patterns by performing a 90% auto-
      correlation test.
  
      For details, see:
      http://www.unic.ac.cy/test/wp-content/uploads/sites/2/2018/09/M4-Competitors-Guide.pdf
  
      Code based on:
      https://github.com/Mcompetitions/M4-methods/blob/master/Benchmarks%20and%20Evaluation.R
      """
      critical_z_score = 1.645  # corresponds to 90% prediction interval
      if len(past_ts_data) < 3 * season_length:
          return False
      else:
          # calculate auto-correlation for lags up to season_length
          auto_correlations = sm.tsa.stattools.acf(
              past_ts_data, fft=False, nlags=season_length
          )
          auto_correlations[1:] = 2 * auto_correlations[1:] ** 2
          limit = (
              critical_z_score
              / np.sqrt(len(past_ts_data))
              * np.sqrt(np.cumsum(auto_correlations))
          )
          is_seasonal = (
              abs(auto_correlations[season_length])
              > limit[season_length]
          )
  
      return is_seasonal
  
file_path: gluonts/src/gluonts/ext/naive_2/_predictor.py
imports: import numpy
  import statsmodels.api
  from gluonts.core.component import validated
  from gluonts.dataset.common import DataEntry
  from gluonts.dataset.util import forecast_start
  from gluonts.model.forecast import Forecast, SampleForecast
  from gluonts.model.predictor import RepresentablePredictor
label_desc: Use image node_id 1 for calling a global function with example usage: seasonality_test(past_ts_data, season_length) and returns: is_seasonal, False