Skip to main content

pytspredit

PyPI version Python versions License: MIT

Python port of the R tspredit — time series prediction with tunable preprocessing, built on the DAL Toolbox Experiment Line.

pytspredit provides a uniform, extensible interface for time series forecasting: sliding-window modeling, normalization, filtering, lag mapping, data augmentation, machine-learning and statistical regressors, and integrated hyperparameter tuning — reusing classic Python libraries (scikit-learn, numpy, pandas, scipy, statsmodels) through thin adapters and self-contained native implementations.

It is part of the DAL Python family:

  • Builds on pydaltoolbox (foundation).
  • Powers the forecasting-based detectors in pyharbinger (time series event detection).

Installation

pip install pytspredit

Quickstart

import pytspredit as ts

series = ts.datasets.tsd()["y"]                  # example series
windows = ts.ts_data(series, sw=10)              # sliding windows: columns t9 ... t0
samp = ts.ts_sample(windows, test_size=5)        # temporal train/test split
io_train = ts.ts_projection(samp.train)          # -> (input X, output t0)
io_test = ts.ts_projection(samp.test)

# a kNN regressor with min-max normalization and PACF-based lag selection
model = ts.TsKnn(ts.TsNormGminmax(), input_size=4, input_map=ts.TsLagmap("pacf"), k=3)
model.fit(io_train.input, io_train.output)

forecast = model.predict(io_test.input.iloc[[0]], steps_ahead=5)   # 5 steps ahead
print(model.evaluate(io_test.output.to_numpy(), forecast)["metrics"])

What's included

Every forecasting component follows a uniform Experiment Line interface (fit → predict / transform → evaluate), so preprocessing, lag selection, augmentation, and regressors can be composed and tuned together.

Group Classes & Functions
Core data utilities ts_data, ts_projection, ts_sample, adjust_ts_data, ts_head
Regression base & metrics TsReg, TsRegSW, mse_ts, smape_ts, r2_ts
Normalizations TsNormNone, TsNormGminmax, TsNormSwminmax, TsNormDiff, TsNormAn (adaptive; 4 operators)
Lag mapping TsLagmap (12 strategies: recent, even, geom, acf, pacf, peaks, seasonal, acf/pacf-seasonal, blocks, mutual information, mRMR)
Filters TsFilNone, TsFilMa, TsFilEma, TsFilWinsor, TsFilRecursive, TsFilFft, TsFilSmooth, TsFilHp, TsFilGabor, TsFilLowess, TsFilSes, TsFilQes, TsFilSeasAdj, TsFilSpline, TsFilKalman, TsFilEmd, TsFilRemd, TsFilWavelet
Augmentation TsAugNone, TsAugFlip, TsAugStretch, TsAugShrink, TsAugJitter, TsAugWormhole, TsAugAwareness, TsAugAwaresmooth
Regressors TsKnn, TsElm, TsRf, TsSvm, TsMlp, TsArima (including auto="cv"), TsDarima, TsWarma, TsDeterministic, TsPeriodic, TsPersist
Multivariate ts_data_mv, adjust_ts_data_mv, ts_mv_spec, TsRegswMv, TsLmMv, TsVar, TsArimax
Tuning & benchmarking TsTune, TsIntegtune, TsPredBench
Plotting plot_series, plot_ts, plot_ts_pred, plot_ts_pred_mv (matplotlib)
Datasets datasets.tsd() and 20 tspredbench benchmark datasets as compact miniatures with on-demand full expansion via datasets.loadfulldata(name)

Guided Tutorial Track

If you are new to pytspredit, start with the guided tutorials in the GitHub examples collection:

  • Tutorials — a 10-part sequential learning path starting with classical ARIMA forecasting protocols (one-step, rolling-origin, multi-step), building a sliding-window MLP pipeline step by step (normalization, filtering, augmentation), and finishing with model comparison and integrated hyperparameter tuning.

Thematic Example Collections

If you already know the basic forecasting workflow, jump directly to any thematic example collection on GitHub:

  • Time-series data utilities — building sliding windows (ts_data), projecting inputs/targets (ts_projection), and temporal train/test splits (ts_sample).
  • Dataset examples — tsd and the 20 benchmark datasets (eunite, nn3, nn5, cats, santafe, ipeadata, m1, m3, m4, stocks, and domain collections).
  • Filtering examples — smoothing, robust, spectral, decomposition (EMD/REMD, MODWT wavelet), state-space (Kalman), and seasonal-adjustment filters.
  • Lag mapping examples — recency, spacing, autocorrelation, partial autocorrelation, seasonal, mutual information, and mRMR lag selection strategies.
  • Normalization examples — global and sliding-window min-max, differencing, and adaptive normalization operators.
  • Data augmentation examples — jitter, flip, stretch, shrink, wormhole, awareness, and aware-smoothing augmenters.
  • Prediction examples — ARIMA (including auto="cv"), kNN, SVM, Random Forest, MLP, ELM, DARIMA, WARMA, and deterministic baselines.
  • Multivariate examples — target-centered multivariate sliding windows (TsRegswMv), linear models (TsLmMv), TsVar, and TsArimax.
  • Tuning examples — model hyperparameter tuning (TsTune) and integrated pipeline tuning (TsIntegtune).
  • Benchmark examples — multi-dataset, multi-model evaluation grids with TsPredBench.
  • Custom examples — extending pytspredit with custom predictors, filters, augmenters, and normalizers.

Main Capabilities

  • Unified abstractions for sliding-window data preparation, normalizers, filters, lag maps, augmenters, regressors, tuners, and benchmark harnesses.
  • Univariate and multivariate forecasting across statistical (TsArima, TsVar, TsArimax), window-linear (TsDarima, TsWarma), deterministic, and machine-learning (TsKnn, TsElm, TsRf, TsSvm, TsMlp) models.
  • Tunable preprocessing pipelines combining invertible normalizations, 18 time-series filters (including native EMD/REMD and MODWT wavelet engines), 12 lag-mapping strategies, and 8 data augmentation methods.
  • Integrated hyperparameter tuning jointly optimizing input window size, preprocessing components, and model hyperparameters (TsTune, TsIntegtune).
  • Benchmarks and visualization with 20+ built-in benchmark datasets (datasets.loadfulldata), reproducible comparison grids (TsPredBench), and forecast plotting utilities (plot_ts_pred, plot_ts_pred_mv).

License

MIT

Metadata

Release files for pytspredit 1.0.707

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytspredit 1.0.707
File Size Uploaded Provenance Actions
pytspredit-1.0.707.tar.gz 125.2 kB Without provenance Details for pytspredit-1.0.707.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytspredit 1.0.707
File Interpreter ABI Platform Actions
pytspredit-1.0.707-py3-none-any.whl Python 3 none any Details for pytspredit-1.0.707-py3-none-any.whl

Total release size: 260.2 kB

Release files / pytspredit-1.0.707.tar.gz

Download URL pytspredit-1.0.707.tar.gz
Size 125.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0f41c7585863e23f62b6a096bd1e3046a6192ca864f8e2281b0578553f81225b
BLAKE2b-256 checksum
How to use checksums
eeb248c47def064390d8d42dfd3e898f354ad37fc7f9ca2aa67a6a9e58b9e5ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / pytspredit-1.0.707-py3-none-any.whl

Download URL pytspredit-1.0.707-py3-none-any.whl
Size 135.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d67eb73fed071d5842935179ac2785b0e602d1018c592e4443fd19d7fcd81e6
BLAKE2b-256 checksum
How to use checksums
2ec8b08b1effa7555e3ff94102e064cb0d6ee38bf650fb44e809292fe71ae7fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Security for pytspredit 1.0.707

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page