fusionlab.datasets.make_multi_feature_time_series

fusionlab.datasets.make_multi_feature_time_series(n_series=3, n_timesteps=100, freq='D', static_noise_level=0.1, trend_base=10, trend_factor=0.1, seasonality_period=7, seasonality_amplitude=5, dynamic_cov_amplitude=2, future_cov_amplitude=1, noise_level=1.0, as_frame=False, seed=None)[source]

Generate multi-variate time series with static, dynamic, and future features.

Creates a synthetic dataset suitable for models like TFT/XTFT. It simulates data for multiple independent series (e.g., items, locations) over a specified number of time steps.

Each series includes: - Static features (unique ID, a noisy base value). - Dynamic features (time index features like month/dayofweek,

a simulated covariate like temperature, lagged target).

  • Known future features (time index features, a simulated binary event like promotion).

  • A target variable generated from trend, seasonality, covariates, static base, and noise.

Parameters:
  • n_series (int, default 3) – Number of independent time series (e.g., items, sensors) to generate.

  • n_timesteps (int, default 100) – Number of time steps (rows) per series.

  • freq (str, default 'D') – Pandas frequency string for generating the datetime index (e.g., ‘D’ for daily, ‘MS’ for month start, ‘H’ for hourly).

  • static_noise_level (float, default 0.1) – Amount of noise added to the static ‘base_level’ feature.

  • trend_base (float, default 10) – Base value for the linear trend component.

  • trend_factor (float, default 0.1) – Slope factor for the linear trend component.

  • seasonality_period (float, default 7) – Periodicity for the main seasonal component (e.g., 7 for weekly pattern with daily data, 12 for yearly pattern with monthly data).

  • seasonality_amplitude (float, default 5) – Amplitude of the main seasonal sinusoidal component.

  • dynamic_cov_amplitude (float, default 2) – Amplitude of the simulated dynamic covariate (e.g., temperature).

  • future_cov_amplitude (float, default 1) – Magnitude of the effect of the simulated future binary event.

  • noise_level (float, default 1.0) – Standard deviation of the Gaussian noise added to the final target signal.

  • as_frame (bool, default False) –

    Determines the return type: - If False (default): Returns a Bunch object containing the

    DataFrame and metadata (column names grouped by type).

    • If True: Returns only the pandas DataFrame.

  • seed (int, optional) – Seed for NumPy’s random number generator for reproducibility. Default is None.

Returns:

data – If as_frame=False (default): A Bunch object with attributes like frame (DataFrame), static_features (list of col names), dynamic_features, future_features, target_col, dt_col, spatial_id_col, and DESCR. If as_frame=True: The generated data solely as a pandas DataFrame.

Return type:

Bunch or pandas.DataFrame

Examples

>>> from fusionlab.datasets.make import make_multi_feature_time_series
>>> # Generate daily data for 5 series
>>> data_bunch = make_multi_feature_time_series(n_series=5, n_timesteps=100,
...                                           freq='D', seasonality_period=7,
...                                           seed=42)
>>> print(data_bunch.frame.head())
>>> print("Static Features:", data_bunch.static_features)
>>> print("Dynamic Features:", data_bunch.dynamic_features)
>>> print("Future Features:", data_bunch.future_features)
>>> # Generate monthly data as DataFrame
>>> df_monthly = make_multi_feature_time_series(n_series=2, n_timesteps=36,
...                                           freq='MS', seasonality_period=12,
...                                           as_frame=True, seed=123)
>>> print(df_monthly.info())