Skip to main content

Forecasting and time series analysis with single-source-of-error state-space models (ADAM, ETS, ARIMA, occurrence, SMA)

Project description

smooth

PyPI version PyPI - Downloads Python versions Python CI SLSA Build Level 3 License: LGPL-2.1

hex-sticker of the smooth package for Python

Python implementation of the smooth package for forecasting and time series analysis using Single Source of Error (SSOE) state-space models.

Every wheel published to PyPI is signed via Sigstore on the exact GitHub Actions runner that built it and ships with PEP 740 attestations (SLSA Build Level 3 provenance). Verify a downloaded wheel client-side with pypi-attestations:

pip install pypi-attestations
pypi-attestations verify pypi --repository https://github.com/config-i1/smooth smooth-*.whl

The package includes the following models:

  • ADAM - Augmented Dynamic Adaptive Model, uniting exponential smoothing, ARIMA and regression, implemented in the ADAM class.
  • ETS - Exponential Smoothing in the SSOE state space form, implemented in the ES class.
  • MSARIMA - Multiple seasonal ARIMA in state space form, implemented in the MSARIMA class (fixed orders) and AutoMSARIMA class (automatic order selection).
  • OM - Occurrence Model for intermittent demand, implemented in the OM class (plus OMG for the general two-component model and AutoOM for automatic type selection).
  • SMA - Simple Moving Average in state-space form (an AR(m) model with fixed coefficients), implemented in the SMA class with automatic order selection.

All of these are implemented with the support of the following features:

  • Automatic components selection in ETS and forecasts combination
  • Explanatory variables
  • Multiple seasonal models (e.g. for high frequency data)
  • Advanced loss functions
  • Fine tuning of any elements of ADAM/ETS/ARIMA/Regression
  • A variety of prediction interval construction methods

Like the R version, the Python smooth depends on the greybox package for distributions, information criteria, regressor selection, and the LOWESS smoother. It is installed automatically as a dependency.

Installation

From PyPI (recommended):

pip install smooth

From source (development):

pip install "git+https://github.com/config-i1/smooth.git@master#subdirectory=python"

See the Installation Guide for platform-specific instructions.

System Requirements

If installing from source, this package requires compilation of C++ extensions. Before installing, ensure you have:

  • C++ compiler (g++, clang++, or MSVC)
  • CMake >= 3.25
  • Armadillo linear algebra library

Quick Example

import numpy as np
from smooth import ADAM

# Sample data
y = np.array([10, 12, 15, 13, 16, 18, 20, 19, 22, 25, 28, 30,
              11, 13, 16, 14, 17, 19, 21, 20, 23, 26, 29, 31])

# Fit ADAM model with additive error, no trend, no seasonality
model = ADAM(model="ANN")
model.fit(y)

# Generate forecasts
forecasts = model.predict(h=12)

# With seasonal component (monthly data, annual seasonality)
model = ADAM(model="ANA", lags=[1, 12])
model.fit(y)
forecasts = model.predict(h=12)

ADAMX — ADAM with Explanatory Variables

This also works with the exponential smoothing (ETSX) via the ES() class.

import numpy as np
from smooth import ADAM

# Simulate data where y depends on two external regressors
rng = np.random.default_rng(42)
n = 120
X = rng.standard_normal((n, 2))
y = 10 + 2 * X[:, 0] - 1.5 * X[:, 1] + rng.standard_normal(n)

# Fit ETSX(AAN) — use all regressors with fixed coefficients
model = ADAM(model="AAN", regressors="use")
model.fit(y, X)
print(model)           # shows fitted coefficients including xreg

# Forecast 12 steps ahead with future regressor values
X_future = rng.standard_normal((12, 2))
fc = model.predict(h=12, X=X_future)
print(fc.mean)

# Automatic variable selection (drops insignificant regressors)
model_sel = ADAM(model="AAN", regressors="select")
model_sel.fit(y, X)

# Adaptive (time-varying) regressor coefficients
model_adp = ADAM(model="AAN", regressors="adapt")
model_adp.fit(y, X)

X accepts a NumPy array or a pandas DataFrame (column names are preserved as regressor names). regressors controls treatment: "use" (fixed coefficients), "select" (stepwise selection via greybox), or "adapt" (ETS-style time-varying coefficients).

AutoMSARIMA — Automatic ARIMA Order Selection

AutoMSARIMA selects the best ARIMA orders automatically using information criteria, mirroring R's auto.msarima(). It fixes distribution="dnorm" and uses pure ARIMA (no ETS components).

import numpy as np
from smooth import AutoMSARIMA

# Monthly time series (e.g. AirPassengers, 144 observations)
y = np.array([
    112, 118, 132, 129, 121, 135, 148, 148, 136, 119, 104, 118,
    # ... remaining observations
], dtype=float)

# Automatic seasonal ARIMA — searches up to ARIMA(3,2,3)(3,1,3)[12]
model = AutoMSARIMA(lags=[1, 12])
model.fit(y)
print(model)   # AutoMSARIMA: ARIMA([p,P],[d,D],[q,Q])

# Reduce search space for speed
model = AutoMSARIMA(
    lags=[1, 12],
    ar_order=[2, 1],   # max AR: p≤2 at lag 1, P≤1 at lag 12
    i_order=[2, 1],    # max I:  d≤2 at lag 1, D≤1 at lag 12
    ma_order=[2, 1],   # max MA: q≤2 at lag 1, Q≤1 at lag 12
)
model.fit(y)
fc = model.predict(h=24)

Documentation

The pages below document the models and their Python classes:

  • ADAM — Augmented Dynamic Adaptive Model — unified ETS/ARIMA/regression framework
  • AutoADAM — Automatic ADAM with distribution and ARIMA order selection
  • ES — Exponential Smoothing (ETS) wrapper for ADAM
  • MSARIMA — Multiple Seasonal ARIMA (fixed orders) and automatic selection (AutoMSARIMA)
  • OM — Occurrence Model for intermittent demand (OM, OMG, AutoOM)
  • SMA — Simple Moving Average in state-space form with automatic order selection

Book: Svetunkov, I. (2023). Forecasting and Analytics with the Augmented Dynamic Adaptive Model (ADAM). Chapman and Hall/CRC. Online: https://openforecast.org/adam/

See Also

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smooth-1.0.5.tar.gz (12.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

smooth-1.0.5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.7 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

smooth-1.0.5-cp313-cp313-win_amd64.whl (6.4 MB view details)

Uploaded CPython 3.13Windows x86-64

smooth-1.0.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

smooth-1.0.5-cp313-cp313-macosx_11_0_arm64.whl (631.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

smooth-1.0.5-cp313-cp313-macosx_10_13_x86_64.whl (662.8 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

smooth-1.0.5-cp312-cp312-win_amd64.whl (6.4 MB view details)

Uploaded CPython 3.12Windows x86-64

smooth-1.0.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

smooth-1.0.5-cp312-cp312-macosx_11_0_arm64.whl (631.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

smooth-1.0.5-cp312-cp312-macosx_10_13_x86_64.whl (662.8 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

smooth-1.0.5-cp311-cp311-win_amd64.whl (6.4 MB view details)

Uploaded CPython 3.11Windows x86-64

smooth-1.0.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

smooth-1.0.5-cp311-cp311-macosx_11_0_arm64.whl (633.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

smooth-1.0.5-cp311-cp311-macosx_10_9_x86_64.whl (661.7 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

File details

Details for the file smooth-1.0.5.tar.gz.

File metadata

  • Download URL: smooth-1.0.5.tar.gz
  • Upload date:
  • Size: 12.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for smooth-1.0.5.tar.gz
Algorithm Hash digest
SHA256 b2ebeb6c615b8f5b4e9fc106f05742e23972c79ee6d00ff08c9a7e88d972ae56
MD5 11423d89940cdae45555bf13923a1e85
BLAKE2b-256 b9289da2014edec28f0288cf761445f5a35c5bffcfb3cc3bf9684fb700a71fb6

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.5.tar.gz:

Publisher: release.yml on config-i1/smooth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smooth-1.0.5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 15d4bb7bce8b7637beca6adc7088e14648428549d62493afaf0e41d2336a981c
MD5 51c7a0aa51bd2243cb15d2ba257b1884
BLAKE2b-256 afbe2388d3b8149a72b5c54d9d266d9efd972f9026d2b5b88294d6fa565cb952

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on config-i1/smooth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smooth-1.0.5-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: smooth-1.0.5-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 6.4 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for smooth-1.0.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 50116eb78fccf166a0bde1c0b668de4d91e7571ab12d4916da90dde0436e9e66
MD5 6e2bb3b8e25584eef9c4ffbc57863daa
BLAKE2b-256 541a68b95ef61a5d762fb9a1ca785221a20f1b498a17506932166c24de615c9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.5-cp313-cp313-win_amd64.whl:

Publisher: release.yml on config-i1/smooth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smooth-1.0.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3b98697bc0b58abf6b7f2cd0f1a7bda437c65bf1f216c0e0600ea8fb159123fe
MD5 e8896d622241464292382d7b04a79021
BLAKE2b-256 77939903aee36e56038a20cb23bee23685f3dfa26473bf819d02b4a5fa013318

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on config-i1/smooth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smooth-1.0.5-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for smooth-1.0.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 77345356821b7a679e16e629f9d2e2b6aceff36dd4834c27751316a6d76f3132
MD5 39e3c431db9222a6ed222774e56b84a2
BLAKE2b-256 aa1c5ba85df4dcec0801a128cba219d957e862553549888f3065f5a8deacea1f

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.5-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on config-i1/smooth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smooth-1.0.5-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.5-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 7f4dc62b228ca79671feacde56c4b355f5ed5a93da16737d3d708d246e66dda0
MD5 2ca09fcf151fda48f99967d0e737d22b
BLAKE2b-256 e01740ca03203421f40be283d1b18256b828f81b19bfb269807b9b249a003754

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.5-cp313-cp313-macosx_10_13_x86_64.whl:

Publisher: release.yml on config-i1/smooth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smooth-1.0.5-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: smooth-1.0.5-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 6.4 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for smooth-1.0.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 113ec3f23be978ccc553fa21017854b61955bf466b02378fd5605c0fd159608d
MD5 917707e28b3deedb288630282eedbe1a
BLAKE2b-256 109b2a531df52fc2d99c979e8eff2e34b7c9d0fdb1489f3bd8fec9d29e415676

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.5-cp312-cp312-win_amd64.whl:

Publisher: release.yml on config-i1/smooth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smooth-1.0.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bd87eeb4d825233a82c5ba320f09cbbd3eaaf6bea8be408f7761dd9e95c32d15
MD5 7ff6b33b138a7321fb2ccd16c4f44b60
BLAKE2b-256 9e9739de1234240b44819f71e6e6e30eb583162b5770cdc52e7e87b526b7b4c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on config-i1/smooth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smooth-1.0.5-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for smooth-1.0.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 65350ba7d6cd10480b653061871be73010af2457f006363766b6b469f3b5e421
MD5 dba12399e6009d7924105e2f9f7b2d2c
BLAKE2b-256 b48efc6b133fbebfc448c70d26e05b1d5efbc0eb47d943fa792c74360d1c580b

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.5-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on config-i1/smooth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smooth-1.0.5-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.5-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 11867a1877dc425442486dc2626294500e42b5a4e561f1ad0ed43b9da3a409a6
MD5 72f8a14ae41523ac5ba3043fb5c382ab
BLAKE2b-256 758b4462c0de50938c4d39346b847d8b900b5c34bb3e2f545f00dff582699320

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.5-cp312-cp312-macosx_10_13_x86_64.whl:

Publisher: release.yml on config-i1/smooth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smooth-1.0.5-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: smooth-1.0.5-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 6.4 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for smooth-1.0.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8f88099cc1ad019f346c0ea4fae1e7371b1540712d1529b5595e032876af3d49
MD5 cbd835a8ba6ecc795f67480225a97896
BLAKE2b-256 cf74a91704b2a40f9bf896cc72bd29c4f29039e67e848d01513c12a13ae4064a

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.5-cp311-cp311-win_amd64.whl:

Publisher: release.yml on config-i1/smooth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smooth-1.0.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c34339bf4cd2b6198e26407224f65cfc6c4b25d0927e96931609284621113393
MD5 61720f25dc6e25ce69aff144a2857ac6
BLAKE2b-256 9ccd9a0e200ffbfce59d59bfec5a41384d76618c988a61eee6dd594f799ab32b

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on config-i1/smooth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smooth-1.0.5-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for smooth-1.0.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6471b1282dd54764d21e11ef9a3df3c2a29b2b142c559f0ce0fa6dacdb0777bf
MD5 8f7db1635287359e5a1b2cdcb255b0cd
BLAKE2b-256 02be2040fccf66ac9ed9273a6f780da0c83b5f3519fb2c8f76b550f341997b04

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.5-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on config-i1/smooth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smooth-1.0.5-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.5-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5920763d60b857f30a5ad6d3b902d06ec3e4d8906a84bf9b4d9b9d48015f397d
MD5 f4f773fde7c401087d6f35ebf1a987e1
BLAKE2b-256 07680d6fb4e298a29bad871470cced0475e7e80d46324ddb371634c005f0d37e

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.5-cp311-cp311-macosx_10_9_x86_64.whl:

Publisher: release.yml on config-i1/smooth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page