code: def generate_df_with_reg_for_tests(
      freq,
      periods,
      train_start_date=datetime.datetime(2018, 7, 1),
      train_end_date=None,
      train_frac=0.8,
      conti_year_origin=None,
      noise_std=2.0,
      remove_extra_cols=True,
      mask_test_actuals=False,
      seed=123,
  ):
      """Generates dataset for unit tests that includes regressor columns
      :param freq: str
          pd.date_range freq parameter, e.g. H or D
      :param periods: int
          number of periods to generate
      :param train_start_date: datetime.datetime
          train start date
      :param train_end_date: Optional[datetime.datetime]
          train end date
      :param train_frac: Optional[float]
          fraction of data to use for training
          only used if train_end_date isn't provided
      :param noise_std: float
          standard deviation of gaussian noise
      :param conti_year_origin: float
          the time origin for continuous time variables
      :param remove_extra_cols: bool
          whether to remove extra columns besides TIME_COL, VALUE_COL
      :param mask_test_actuals: bool
          whether to set y values to np.NaN in the test set.
      :param seed: int
          seed for reproducible result
      :return: Dict with train dataframe, test dataframe, and nrows in test dataframe
      """
      if seed is not None:
          np.random.seed(seed)
  
      result_list = generate_df_for_tests(
          freq,
          periods,
          train_start_date=train_start_date,
          train_end_date=train_end_date,
          train_frac=train_frac,
          conti_year_origin=conti_year_origin,
          noise_std=noise_std,
          remove_extra_cols=False,
      )
  
      df = result_list["df"]
      df["regressor1"] = (
          df["growth"]
          + 4
          * df[
              get_fourier_col_name(
                  1, TimeFeaturesEnum.tow.value, function_name="sin"
              )
          ]
          - 3
          * df[
              get_fourier_col_name(
                  1, TimeFeaturesEnum.tod.value, function_name="sin"
              )
          ]
          + 7
          * df[
              get_fourier_col_name(
                  1, TimeFeaturesEnum.toy.value, function_name="sin"
              )
          ]
          - noise_std * np.random.normal(size=df.shape[0])
      )
  
      df["regressor2"] = (
          df["growth"]
          + 1
          * df[
              get_fourier_col_name(
                  1, TimeFeaturesEnum.tow.value, function_name="sin"
              )
          ]
          - 2
          * df[
              get_fourier_col_name(
                  1, TimeFeaturesEnum.tod.value, function_name="sin"
              )
          ]
          + 3
          * df[
              get_fourier_col_name(
                  1, TimeFeaturesEnum.toy.value, function_name="sin"
              )
          ]
          + noise_std * np.random.normal(size=df.shape[0])
      )
  
      df["regressor3"] = (
          df["growth"]
          + 9
          * df[
              get_fourier_col_name(
                  1, TimeFeaturesEnum.tow.value, function_name="sin"
              )
          ]
          - 8
          * df[
              get_fourier_col_name(
                  1, TimeFeaturesEnum.tod.value, function_name="sin"
              )
          ]
          + 5
          * df[
              get_fourier_col_name(
                  1, TimeFeaturesEnum.toy.value, function_name="sin"
              )
          ]
          + noise_std * np.random.normal(size=df.shape[0])
      )
  
      df["regressor_bool"] = np.random.rand(df.shape[0]) > 0.3
      df["regressor_categ"] = np.random.choice(
          a=["c1", "c2", "c3"], size=df.shape[0], p=[0.1, 0.2, 0.7]
      )
  
      if train_end_date is None:
          train_rows = np.floor(train_frac * df.shape[0]).astype(int)
          train_end_date = df[TIME_COL][train_rows]
  
      regressor_cols = [
          "regressor1",
          "regressor2",
          "regressor3",
          "regressor_bool",
          "regressor_categ",
      ]
      if remove_extra_cols:
          df = df[[TIME_COL, VALUE_COL] + regressor_cols]
  
      if mask_test_actuals:
          # False positive warning:
          #   pandas.core.common.SettingWithCopyError:
          #   A value is trying to be set on a copy of a slice from a DataFrame.
          #   Try using .loc[row_indexer,col_indexer] = value instead
          with warnings.catch_warnings():
              warnings.simplefilter("ignore")
              df.loc[df[TIME_COL] > train_end_date, VALUE_COL] = np.NaN
  
      train_df = df.loc[df[TIME_COL] <= train_end_date]
      test_df = df.loc[df[TIME_COL] > train_end_date]
      fut_time_num = test_df.shape[0]
  
      return {
          "df": df,
          "train_df": train_df,
          "test_df": test_df,
          "fut_time_num": fut_time_num,
          "regressor_cols": regressor_cols,
      }
  
imports: import datetime
  import warnings
  import numpy
  import pandas
  from greykite.common.constants import ADJUSTMENT_DELTA_COL
  from greykite.common.constants import ANOMALY_COL
  from greykite.common.constants import END_TIME_COL
  from greykite.common.constants import EVENT_DF_LABEL_COL
  from greykite.common.constants import METRIC_COL
  from greykite.common.constants import START_TIME_COL
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
  from greykite.common.constants import TimeFeaturesEnum
  from greykite.common.features.timeseries_features import add_daily_events
  from greykite.common.features.timeseries_features import build_time_features_df
  from greykite.common.features.timeseries_features import fourier_series_multi_fcn
  from greykite.common.features.timeseries_features import get_default_origin_for_time_vars
  from greykite.common.features.timeseries_features import get_fourier_col_name
  from greykite.common.features.timeseries_features import get_holidays
  from greykite.common.python_utils import assert_equal
label_desc: Use image node_id 3 for calling a global function with example usage: generate_df_with_reg_for_tests(freq, periods, train_start_date, train_end_date, train_frac, conti_year_origin, noise_std, remove_extra_cols, mask_test_actuals, seed) and returns: dict