Skip to main content

generate_series

Generate a synthetic panel of time series. Series are drawn from a balanced pool of generators covering diverse temporal behaviors (or from generators when provided) and returned in long format, mirroring utilsforecast.data.generate_series. Series are spread evenly across the generator list from the front, so when n_series is smaller than the pool only the first n_series generators contribute. The default pool is ordered round-robin across its behavioral niches, so a small panel still spans distinct behaviors: the first 15 generators cover all 15 niches. Parameters: Returns:

balanced_pool

Create a balanced pool of generators covering diverse temporal behaviors. Returns 42 pre-configured generator instances across 15 behavioral niches, with allocation proportional to each generator’s behavioral range. This avoids the implicit bias toward financial processes that occurs when using all generators equally. The list is ordered round-robin across the niches (one variant of every niche, then second variants, and so on), so any prefix spans as many distinct behaviors as possible: the first 15 entries cover all 15 niches. Consumers that use only the first k generators — such as generate_series with n_series < 42 — therefore still get a behaviorally diverse panel. Parameters: Returns: Examples:

pretraining_pool

Create a breadth-maximizing pool for foundation-model pretraining. This is the pretraining-oriented counterpart to :func:balanced_pool. It adds the diversity-targeted meta-generators that balanced_pool deliberately excludes — TSIGenerator (randomized trend/seasonal/ irregular composition), TCMGenerator (random temporal causal graphs), and KernelSynthGenerator (samples from randomly composed GP kernels). Each resamples a fresh configuration per series, so a handful of instances spans a very wide distribution. By default it also includes the full balanced_pool so the corpus carries interpretable single-mechanism behaviors alongside the meta-generators. Unlike balanced_pool, the default length range is wide (256-1024 steps), matching the longer contexts typical of pretraining. Parameters: Returns: Examples:

Multivariatizer

Bases: BaseModel Wrap a univariate :class:BaseGenerator to produce correlated channels. generate(n_series) draws n_series independent series of one shared length from the wrapped generator, standardizes them, applies the configured couplings, then restores each channel’s original level and scale. The output is the same long-format frame the wrapped generator produces (its id_col/time_col/target_col and engine). Couplings (both may compose; mixing is applied first):
  • "mixing" (cotemporaneous): channels become instantaneous linear combinations Z @ L.T of the standardized bases, where L is the Cholesky factor of a random well-conditioned correlation target C = (1 - s) I + s Q. Q is the correlation matrix of a random Gaussian Gram matrix and s (the mixing strength, drawn from mixing_strength_range) directly sets the magnitude of the induced cross-correlations; s < 1 keeps C positive definite, so L is well conditioned.
  • "leadlag" (sequential): each non-root channel becomes, with probability 0.5 (at least one always does), a lagged, sign-flipped, noise-perturbed copy of an earlier channel: z_j = sign * roll(z_src, lag) + sigma * eps with lag from lag_range (clamped below the series length, circular wrap so all channels share the same timestamps) and sigma from noise_scale_range. Per-channel scaling comes from the level/scale restore.
Guards: every drawn base series must be finite with |x| < 1e8 and std > 1e-8; violating draws are redrawn up to 5 times, then replaced by unit Gaussian noise. Seeding: the multivariatizer’s own seed fully determines the output. The wrapped generator is copied and reseeded from the multivariatizer’s rng on every generate call, so the base generator’s own seed and rng state never influence the result and the original object is not mutated. The last sampled coupling recipe (mixing strength/matrix, lead-lag pairs with their lags) is exposed as last_recipe for introspection. Parameters:

Multivariatizer.generate

Generate n_series cross-dependent channels from the wrapped base. All channels share one length drawn from the base generator’s [min_length, max_length]; each channel is one unique_id in the long-format output. Parameters: Returns:

Multivariatizer.last_recipe

The coupling recipe sampled by the most recent generate() call.