docstr: Sanity check with vanilla sktime mixer using a synthetic square wave sampled at a 15 seconds interval
docstr_tok: ["Sanity","check","with","vanilla","sktime","mixer","using","a","synthetic","square","wave","sampled","at","a","15","seconds","interval"]
code: def test_6_time_series_sktime_mixer(self):
      """Sanity check with vanilla sktime mixer using a synthetic square wave sampled at a 15 seconds interval"""
      tsteps = 100
      target = "Value"
      horizon = 20
      spacing = 15
      df = pd.DataFrame(columns=["Time", target])
      start_ts = datetime(2022, 12, 31, 23, 59, 00)
      ts_gen = np.linspace(0, 100 * spacing, tsteps, endpoint=False)
      df["Time"] = [
          str(start_ts + timedelta(seconds=f)) for f in ts_gen
      ]
      df[target] = [
          i + f
          for i, f in enumerate(
              signal.sawtooth(2 * np.pi * 5 * ts_gen, width=0.5)
          )
      ]
      df[f"{target}_2x"] = [2 * elt for elt in df[target].values]
      train = df[: int(len(df) * 0.8)]
      test = df[int(len(df) * 0.8) :]
      pdef = ProblemDefinition.from_dict(
          {
              "target": target,
              "time_aim": 200,
              "timeseries_settings": {
                  "order_by": "Time",
                  "window": 5,
                  "horizon": horizon,
                  "historical_columns": [f"{target}_2x"],
              },
          }
      )
      json_ai = json_ai_from_problem(df, problem_definition=pdef)
      json_ai.model["args"]["submodels"] = [
          {
              "module": "SkTime",
              "args": {
                  "stop_after": "$problem_definition.seconds_per_mixer",
                  "horizon": "$problem_definition.timeseries_settings.horizon",
              },
          }
      ]
      predictor = predictor_from_code(code_from_json_ai(json_ai))
      train_and_check_time_aim(predictor, train)
      ps = predictor.predict(test)
      assert (
          r2_score(test[target].values, ps["prediction"].iloc[0]) >= 0.5
      )
  
imports: import random
  from datetime import datetime
  from datetime import timedelta
  import unittest
  import numpy
  import pandas
  from typing import List
  from scipy import signal
  from sklearn.metrics import r2_score
  from lightwood.api.types import ProblemDefinition
  from tests.utils.timing import train_and_check_time_aim
  from sktime.forecasting.base import ForecastingHorizon
  from sktime.forecasting.statsforecast import StatsForecastAutoARIMA
  from dataprep_ml.splitters import stratify
  from lightwood.api.high_level import json_ai_from_problem, code_from_json_ai, predictor_from_code, predictor_from_problem, predictor_from_json_ai
  from lightwood.mixer.sktime import SkTime
label_desc: Use image node_id 9 for calling the TestTimeseries obj's underlying member method code with example usage: obj.test_6_time_series_sktime_mixer() without return types