docstr: Test double-grouped numerical predictions, replicates quick start guide in cloud.mindsdb.com 
docstr_tok: ["Test","double-grouped","numerical","predictions",",","replicates","quick","start","guide","in","cloud.mindsdb.com"]
code: def test_8_time_series_double_grouped_regression(self):
      """Test double-grouped numerical predictions, replicates quick start guide in cloud.mindsdb.com"""
      data = pd.read_csv("tests/data/house_sales.csv")
      gby = ["bedrooms", "type"]
      target = "MA"
      order_by = "saledate"
      window = 8
      for horizon in [1, 4]:
          train, _, test = stratify(
              data,
              pct_train=0.8,
              pct_dev=0,
              pct_test=0.2,
              stratify_on=gby,
              seed=1,
              reshuffle=False,
          )
          jai = json_ai_from_problem(
              train,
              ProblemDefinition.from_dict(
                  {
                      "target": target,
                      "time_aim": 30,  # short time aim
                      "timeseries_settings": {
                          "group_by": gby,
                          "horizon": horizon,
                          "order_by": order_by,
                          "window": window,
                      },
                  }
              ),
          )
          code = code_from_json_ai(jai)
          pred = predictor_from_code(code)
  
          # Test with inferring mode, check timestamps are further into the future than test dates
          test["__mdb_forecast_offset"] = 1
          train_and_check_time_aim(pred, train, ignore_time_aim=True)
          preds = pred.predict(test)
          self.check_ts_prediction_df(preds, horizon, [order_by])
  
          for idx, row in preds.iterrows():
              row[f"order_{order_by}"] = (
                  [row[f"order_{order_by}"]]
                  if horizon == 1
                  else row[f"order_{order_by}"]
              )
              for timestamp in row[f"order_{order_by}"]:
                  assert (
                      timestamp
                      > pd.to_datetime(test[order_by], utc=True)
                      .max()
                      .timestamp()
                  )
  
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 12 for calling the TestTimeseries obj's underlying member method code with example usage: obj.test_8_time_series_double_grouped_regression() without return types