code: def assert_equal_with_tsdataset(
      df,
      horizon,
      lookback,
      feature_num=1,
  ):
      # get results rolled by tsdata.roll
      extra_feature_col = (
          None if feature_num == 0 else ["extra feature"]
      )
      tsdata = TSDataset.from_pandas(
          df,
          dt_col="datetime",
          target_col="value",
          extra_feature_col=extra_feature_col,
          id_col="id",
          repair=False,
      )
      tsdata.roll(lookback=lookback, horizon=horizon)
      if horizon == 0:
          x = tsdata.to_numpy()
      else:
          x, y = tsdata.to_numpy()
  
      # get results rolled by RollDataset
      roll_dataset = RollDataset(
          df=df,
          dt_col="datetime",
          freq=None,
          lookback=lookback,
          horizon=horizon,
          feature_col=tsdata.feature_col,
          target_col=tsdata.target_col,
          id_col=tsdata.id_col,
      )
  
      assert len(roll_dataset) == len(x)
      for i in range(len(x)):
          if horizon != 0:
              # for train and y is not None.
              xi, yi = x[i], y[i]
              roll_dataset_xi, roll_dataset_yi = roll_dataset[i]
              np.testing.assert_array_almost_equal(
                  xi, roll_dataset_xi.detach().numpy()
              )
              np.testing.assert_array_almost_equal(
                  yi, roll_dataset_yi.detach().numpy()
              )
          else:
              # for test, only x.
              xi = x[i]
              roll_dataset_xi = roll_dataset[i]
              np.testing.assert_array_almost_equal(
                  xi, roll_dataset_xi.detach().numpy()
              )
  
file_path: BigDL/python/chronos/test/bigdl/chronos/data/utils/test_roll_dataset.py
imports: import pytest
  import numpy
  import pandas
  import random
  from bigdl.chronos.data import TSDataset
  from bigdl.chronos.utils import LazyImport
  from ...None import op_torch
label_desc: Use image node_id 1 for calling the TestRollDataset obj's underlying member method code with example usage: obj.assert_equal_with_tsdataset(df, horizon, lookback, feature_num) without return types