def from_synthetic_ar_data(
    seasonality: float = 10.0,
    timesteps: int = 400,
    n_series: int = 100,
    max_encoder_length: int = 60,
    max_prediction_length: int = 20,
    batch_size: int = 4,
    num_workers: int = 0,
    **time_series_dataset_kwargs,
) -> TabularForecastingData:
    """Creates and loads a synthetic Auto-Regressive (AR) data set."""
    data = generate_ar_data(seasonality=seasonality, timesteps=timesteps, n_series=n_series, seed=42)
    data["date"] = pd.Timestamp("2020-01-01") + pd.to_timedelta(data.time_idx, "D")

    training_cutoff = data["time_idx"].max() - max_prediction_length

    return TabularForecastingData.from_data_frame(
        time_idx="time_idx",
        target="value",
        categorical_encoders={"series": NaNLabelEncoder().fit(data.series)},
        group_ids=["series"],
        # only unknown variable is "value" - and N-Beats can also not take any additional variables
        time_varying_unknown_reals=["value"],
        max_encoder_length=max_encoder_length,
        max_prediction_length=max_prediction_length,
        train_data_frame=data[lambda x: x.time_idx <= training_cutoff],
        val_data_frame=data,
        batch_size=batch_size,
        num_workers=num_workers,
        **time_series_dataset_kwargs,
    )
Creates and loads a synthetic Auto-Regressive (AR) data set.
src/flash/tabular/forecasting/cli.py