Skip to main content

SynSet

Generate synthetic time series datasets from multiple generators. Combine multiple generators into one long-format panel; each generator contributes its own type of time series pattern. Parameters: Examples:
Initialize the SynSet with a list of generators. Parameters: Raises:

SynSet.generate

Generate synthetic time series data from all generators. Parameters: Returns:

SynAugment

Augment time series datasets with synthetic series. Four strategies share the same column contract and seeding:
  • :meth:augment fits a parametric generator per series and simulates from it (IDs "{original_id}_aug_{i}").
  • :meth:mixup forms convex combinations of scaled series (mean absolute scaling by default; z-normalization is optional) (IDs "mixup_{i}").
  • :meth:mbb bootstraps decomposition remainders in moving blocks (IDs "{original_id}_mbb_{i}").
  • :meth:dba averages nearest neighbours with DTW barycenters (IDs "{original_id}_dba_{i}").
The fit-and-simulate process behind :meth:augment:
  1. For each unique series in the input DataFrame, analyze its statistical properties
  2. Auto-select the most appropriate generator (or use user override)
  3. Fit generator parameters to match the series’ statistical fingerprint
  4. Generate n_augment synthetic series that preserve these properties
  5. Return combined DataFrame with original and synthetic series
Series that are entirely missing (or, for :meth:mbb, shorter than four observations) are skipped with a logged warning by :meth:mixup, :meth:mbb, and :meth:dba. Parameters: Initialize the SynAugment instance. Parameters:

SynAugment.analyze

Analyze all series in DataFrame and return properties. For each unique series, detects statistical properties and recommends the most appropriate generator. Parameters: Returns: Raises:

SynAugment.augment

Augment dataset with synthetic series. For each series in the input DataFrame, generates n_augment synthetic series that are statistically similar to the original. Parameters: Returns: Raises:

SynAugment.augment_single_series

Augment a single series (lower-level API). Parameters: Returns:

SynAugment.mixup

Augment a dataset with TSMixup convex combinations of real series. Implements TSMixup, the augmentation used to pretrain the Chronos forecasting models (Ansari et al. 2024, “Chronos: Learning the Language of Time Series”, https://arxiv.org/abs/2403.07815, Apache-2.0). Each synthetic series is built by drawing 1..max_mix source series, taking a random window of their shared (minimum) length, scaling each window, and combining them with convex weights sampled from a Dirichlet(alpha) distribution. Unlike :meth:augment, a mixup series is not tied to a single source: it blends the dynamics of several, which broadens a small panel without fitting any generator. Because the mixed series live in scaled space (different sources have different magnitudes), the output retains the chosen scaling rather than any single source’s level. Use scaling="none" to mix raw values when all series already share a scale. Parameters: Returns: Raises:

SynAugment.mbb

Bootstrap decomposition remainders with moving blocks. This non-parametric augmenter follows the moving-block-bootstrap idea used for forecasting by Bergmeir, Hyndman, and Benitez (2016, https://doi.org/10.1016/j.ijforecast.2015.07.002) and the augmentation recipe discussed by Bandara et al. (2021, https://arxiv.org/abs/2008.02663). SynForecast uses a classical moving-average decomposition rather than Box-Cox plus STL; its defaults, block-size choice, and stability guards are its own design rather than a reproduction of the reference code. This method deliberately bypasses the _match_autocorrelation rescaling used by :meth:augment. Recombining a source’s own trend and seasonal components with bootstrapped remainder blocks already anchors the result to that source; re-pinning mean and standard deviation would distort the remainder variability. Classical decomposition and moving-block sampling execute in native Rust. Seed determinism is stable within this native path. NaNs are interpolated before decomposition. Series without a finite observation or with fewer than four observations are skipped with a logged warning; at least one series must be usable. Additional input columns are copied unchanged from each source series. The effective block length, including an explicitly supplied block_size, is capped per source series at max(2, len(series) // 3). This keeps multiple remainder blocks in play for short inputs; request a smaller value when the exact block length matters. An explicit period requires at least two cycles per source. Shorter sources use nonseasonal decomposition and are listed in a logged warning. Infinite values reject the call with the offending series ID; NaNs follow the interpolation/skip policy above. Parameters: Returns: Raises:

SynAugment.dba

Augment a panel with randomized nearest-neighbor DTW barycenters. DBA comes from Petitjean, Ketterlin, and Gancarski (2011, https://doi.org/10.1016/j.patcog.2010.09.013); nearest-neighbor weighted augmentation follows Forestier et al. (2017, https://doi.org/10.1109/ICDM.2017.106) and Bandara et al. (2021, https://arxiv.org/abs/2008.02663). Neighbor weighting, per-copy weight randomization, banded DTW, and z-normalized alignment are SynForecast’s own design rather than a reproduction of the reference code. Pairwise panel distances are computed once per call in bounded parallel chunks, retaining only the nearest neighbors per source. Neighbor storage is O(number of series * n_neighbors); distance computation still examines every pair. The band limits the otherwise quadratic alignment cost. This panel-aware method caches every usable source series once and deliberately bypasses _match_autocorrelation. With the default scale="reference", inputs are z-normalized for alignment and the barycenter is mapped to the reference mean and standard deviation. That is explicit reference anchoring, not the :meth:augment pinning path. scale="none" averages raw values for panels already sharing scale. Plain DBA is deterministic, so each requested copy randomizes the reference and neighbor weights to create distinct augmentations. Additional input columns are copied unchanged from the reference series; DBA only barycenters the target column. Copies share their initial alignment paths and refine in parallel in native Rust. At most eight alignments/copies execute concurrently. Parent storage per alignment, cached paths per copy and returned copies per reference have separate 64 MiB limits; excessive requests raise ValueError. Interrupts are checked between work chunks. Seed determinism is stable within this native path. NaNs are interpolated; entirely missing sources are skipped with a warning. Infinite values reject the call with the offending series ID. Reference scaling preserves zero scale for constant sources, producing constant copies. Sources with standard deviation below 1e-8 are listed in a warning because their copies may add little or no variation. Parameters: Returns: Raises: