Skip to main content

IntermittentDemandGenerator

Bases: BaseGenerator Generate intermittent demand time series with sparse patterns. Demand is a two-part process: a binary occurrence process decides at which periods demand happens, and a size distribution draws the demand quantity for those periods (all other periods are zero). Common in retail, spare parts, and inventory contexts (Croston-style demand). Size distributions are moment-matched to (demand_mean, demand_std):
  • ‘poisson’: Poisson(demand_mean); demand_std is ignored.
  • ‘negative_binomial’: p = mean/var, n = mean*p/(1-p); falls back to Poisson when demand_std**2 <= demand_mean.
  • ‘lognormal’: mu = ln(mean^2 / sqrt(var + mean^2)), sigma^2 = ln(1 + var/mean^2).
  • ‘gamma’: shape = (mean/std)^2, scale = var/mean. Sizes are clipped from below at min_demand.
Parameters:

IntermittentDemandGenerator.generate_single_series

Generate values for a single intermittent demand time series. Parameters: Returns:

IoTSensorGenerator

Bases: BaseGenerator Generate IoT sensor readings with realistic degradation patterns. The signal is base_value + trend * t plus optional sinusoidal seasonality, a calibration offset, a cumulative drift random walk (drift_rate per step with drift_noise variation), and Gaussian measurement noise. After battery_life steps, noise grows and the signal is attenuated at battery_degradation_rate. Failures can be injected as NaN gaps (‘intermittent’), a permanent NaN tail (‘complete’), or frozen readings (‘stuck’). With n_sensors > 1, each generated “series” is a network of sensors whose measurement noise is spatially correlated (corr[i, j] = spatial_correlation ** |i - j|); each sensor becomes a separate output series. Parameters:

IoTSensorGenerator.generate_single_series

Generate values for a single sensor. Parameters: Returns:

IoTSensorGenerator.generate

Generate IoT sensor data. With n_sensors == 1, generates n_series independent sensors. With n_sensors > 1, generates n_series sensor networks, each contributing n_sensors correlated series. Parameters: Returns:

EnergyLoadGenerator

Bases: BaseGenerator Generate electricity demand with nested daily/weekly/yearly cycles. The load is a base level plus:
  • A daily profile depending on load_type: residential has Gaussian morning/evening peaks, commercial a broad midday peak, industrial a near-constant profile with a night dip.
  • A weekly cycle: weekend reduction for residential/commercial, a sinusoidal pattern for industrial.
  • A yearly cosine cycle peaking around the series start (winter).
  • Temperature-driven load: both heating (cold) and cooling (hot) increase demand proportionally to |temperature - base_temperature|.
  • Holiday reductions, random extreme-weather multipliers, and Gaussian noise. The result is clipped at zero.
Hour of day, day of week and day of year are derived from the step position relative to the series start using the step size implied by freq (an integer freq is treated as hourly). Parameters:

EnergyLoadGenerator.generate_single_series

Generate values for a single energy load series. Parameters: Returns:

StateSpaceGenerator

Bases: BaseGenerator Generate time series from a (linear-Gaussian or custom) state space model. The linear model is:
with x[0] ~ N(initial_state, initial_state_covariance). State noise w follows the configured innovation distribution (scaled by the Cholesky/PSD factor of Q); observation noise v is Gaussian. The univariate output is the first observation dimension y[t][0], with y[0] observing the initial state. Custom nonlinear dynamics can be supplied via transition_fn / observation_fn, each called as fn(x, t, rng). Parameters:

StateSpaceGenerator.generate_single_series

Generate values for a single state space series. Parameters: Returns:

StateSpaceGenerator.generate_with_states

Generate series and return both observations and hidden states. Only missingness is applied to the observations (changepoints and anomalies would desynchronize them from the returned states). Parameters: Returns: (observations DataFrame in long format, states DataFrame with one state_j column per state dimension).

DailyActiveUsersGenerator

Bases: BaseGenerator Generate Daily Active Users time series with event-driven jumps. The DAU level is base_users * (1 + growth_rate)^day with a weekend multiplier, plus a decaying boost from random events: with probability event_probability per step an event adds (impact - 1) * base to a boost that decays geometrically at rate event_decay_rate. Proportional Gaussian noise is added and the result is clipped at zero. The day index is derived from the step position relative to the series start using the step size implied by freq (an integer freq is treated as daily). Weekends are day indices 5 and 6 of each 7-day block. Also outputs an exogenous column marking the steps where events occur, usable as a feature for forecasting models. Parameters:

DailyActiveUsersGenerator.generate_single_series

Generate values for a single DAU time series. Also populates self._current_events with event indicators. Parameters: Returns:

DailyActiveUsersGenerator.generate

Generate synthetic DAU time series data with event indicators. Parameters: Returns:

VitalSignsGenerator

Bases: BaseGenerator Generate realistic vital signs time series for healthcare applications. Simulates one of six vital signs (heart rate, systolic/diastolic blood pressure, respiratory rate, SpO2, temperature) as a per-series baseline plus a slow random-walk drift, a circadian rhythm, heart rate variability (for HR and BP), random physiological events (activity bursts, rest periods, spikes), measurement noise, and cross-vital correlations with heart rate. Values are clipped to physiological bounds that depend on the patient archetype. Parameters:

VitalSignsGenerator.generate_single_series

Generate values for a single vital signs time series. Parameters: Returns:

VitalSignsGenerator.generate_all_vitals

Generate all six vital signs for complete patient monitoring. Parameters: Returns:

VitalSignsGenerator.get_model_info

Get information about the vital signs model. Returns:

ClickstreamGenerator

Bases: BaseGenerator Generate web clickstream/session time series for analytics applications. Human sessions per time bin are Poisson-distributed around base_sessions modulated by hour-of-day/day-of-week seasonality and a slow log-random-walk trend. Bot traffic (flatter profile plus occasional crawl spikes) can be added on top. Bounces, pageviews (geometric page depth for engaged sessions) and conversions are derived per bin from the human sessions, with multipliers depending on traffic_source. Output types:
  • ‘sessions’: total session counts (human + bot) per time bin
  • ‘pageviews’: total pageviews per time bin
  • ‘conversions’: conversion counts per time bin
  • ‘bounce_rate’: bounced fraction of total sessions per time bin
Parameters:

ClickstreamGenerator.generate_single_series

Generate values for a single clickstream time series. Parameters: Returns:

ClickstreamGenerator.generate_full_metrics

Generate all clickstream metrics for complete analytics. Parameters: Returns:

ClickstreamGenerator.generate_funnel

Generate a conversion funnel with stage-by-stage drop-off. Retention between stages rises from ~0.4 to ~0.7 (committed users drop off less), adjusted by the traffic source’s conversion multiplier. Parameters: Returns:

ClickstreamGenerator.get_model_info

Get information about the clickstream model. Returns: