code: def get_synthetic_data_linear(
      context_length=24,
      prediction_length=8,
      num_groups=8,
      steps_per_ts=1,
      num_duplicates=16,
  ):
      assert num_groups > 1
      freq = "1H"
      len_sample = context_length + prediction_length
  
      dataset_group = []
      whole_data = []
      ret = dict()
      start = pd.Timestamp("01-01-2000", freq=freq)
      for gid in range(num_groups):
          model1 = torch.nn.Linear(context_length, prediction_length)
          model2 = torch.nn.Linear(context_length, prediction_length)
          # model1 = torch.sin
          # model2 = torch.cos
          pattern_group1 = []
          pattern_group2 = []
          sample_context = torch.rand(context_length)
          for t_step in range(2 * steps_per_ts):
              while True:
                  with torch.no_grad():
                      if t_step <= steps_per_ts:
                          prediction = model1(sample_context)
                      else:
                          prediction = model2(sample_context)
                      if (
                          torch.norm(prediction) < prediction_length
                      ):  # and prediction_length*0.1 < torch.norm(prediction):
                          # prediction = torch.sin(prediction)
                          # prediction /= torch.max(prediction)
                          break
                      # prediction *= 10
                      # prediction += torch.normal(0, 0.1, size=prediction.shape)
              ts_sample = torch.cat([sample_context, prediction])
              # print(ts_sample)
              for j in range(num_duplicates):
                  ts_sample += torch.normal(
                      0, 0.1, size=ts_sample.shape
                  )
                  whole_data.append(
                      {"target": ts_sample, "start": start}
                  )
                  if t_step <= steps_per_ts:
                      pattern_group1.append(
                          {"target": ts_sample, "start": start}
                      )
                  else:
                      pattern_group2.append(
                          {"target": ts_sample, "start": start}
                      )
              sample_context = ts_sample[-context_length:]
              start += pd.Timedelta(hours=prediction_length)
          dataset_group.append(ListDataset(pattern_group1, freq=freq))
          """
          dataset_group.append(
              ListDataset(
                  pattern_group2,
                  freq=freq
              )
          )
          """
      print(len(whole_data))
      ret["group_ratio"] = [
          len(i) / len(whole_data) for i in dataset_group
      ]
      print(ret["group_ratio"])
      random.shuffle(whole_data)
      ret["whole_data"] = ListDataset(whole_data, freq=freq)
      ret["group_data"] = dataset_group
  
      # save to files
      with open("synthetic_linear_new_whole_data.csv", "wb") as output:
          pickle.dump(ret["whole_data"], output)
  
      with open("synthetic_linear_new_group_data.csv", "wb") as output:
          pickle.dump(ret, output)
  
      return True
  
imports: from pts.dataset.repository.datasets import get_dataset, dataset_recipes
  from pts.dataset.utils import to_pandas
  import numpy
  import pandas
  from pts.dataset import ListDataset
  import torch
  from pts.model.simple_feedforward import SimpleFeedForwardEstimator
  import pickle
  import json
  import random
label_desc: Use image node_id 12 for calling a global function with example usage: get_synthetic_data_linear(context_length, prediction_length, num_groups, steps_per_ts, num_duplicates) and returns: True