Skip to main content

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/openforecast-org/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.
  • CES - Complex Exponential Smoothing with complex-valued smoothing parameters, implemented in the CES class (fixed seasonality type) and AutoCES class (automatic seasonality selection).
  • 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.

The package also provides standalone data generators that mirror R's sim.* family — sim_es, sim_ssarima, sim_ces, sim_gum, sim_sma, and sim_oes — plus a .simulate() method on fitted ADAM, OM, and OMG objects. See Simulation Functions.

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/openforecast-org/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)

CES — Complex Exponential Smoothing

CES and AutoCES mirror R's ces() / auto.ces(). CES uses complex-valued smoothing parameters to capture both the level and the "potential" of a series, covering four seasonality modes: "none", "simple", "partial", "full".

import numpy as np
from smooth import CES, AutoCES

y = np.array([
    112, 118, 132, 129, 121, 135, 148, 148, 136, 119, 104, 118,
    115, 126, 141, 135, 125, 149, 170, 170, 158, 133, 114, 140,
], dtype=float)

# CES with a fixed seasonality type
model = CES(seasonality="partial", lags=[1, 12], h=6, holdout=True)
model.fit(y)
print(model.model_name)         # e.g. "CES(partial)"
print(model.a_, model.b_)       # complex smoothing parameters
fc = model.predict(h=6)
print(fc.mean)

# AutoCES — select the best seasonality type by information criterion
auto = AutoCES(lags=[1, 12], h=6, holdout=True, ic="AICc")
auto.fit(y)
print(auto.best_model_.model_name)

Note: strict R-parity in the two-stage NLopt path requires nlopt>=2.10.0; older versions still fit, but the BOBYQA stage-1 trajectory may differ slightly from R.

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
  • CES — Complex Exponential Smoothing (CES, AutoCES)
  • 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
  • Simulation Functionssim_es, sim_ssarima, sim_ces, sim_gum, sim_sma, sim_oes, and the .simulate() method on fitted models

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

About

smooth is developed and maintained by OpenForecast, a demand forecasting and inventory management consultancy. The package implements the methods we use in our consulting and teach in our training courses.

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.8.tar.gz (22.1 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.8-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (13.0 MB view details)

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

smooth-1.0.8-cp313-cp313-win_amd64.whl (13.8 MB view details)

Uploaded CPython 3.13Windows x86-64

smooth-1.0.8-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (13.0 MB view details)

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

smooth-1.0.8-cp313-cp313-macosx_11_0_arm64.whl (906.3 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

smooth-1.0.8-cp313-cp313-macosx_10_13_x86_64.whl (964.5 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

smooth-1.0.8-cp312-cp312-win_amd64.whl (13.8 MB view details)

Uploaded CPython 3.12Windows x86-64

smooth-1.0.8-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (13.0 MB view details)

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

smooth-1.0.8-cp312-cp312-macosx_11_0_arm64.whl (906.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

smooth-1.0.8-cp312-cp312-macosx_10_13_x86_64.whl (964.4 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

smooth-1.0.8-cp311-cp311-win_amd64.whl (13.8 MB view details)

Uploaded CPython 3.11Windows x86-64

smooth-1.0.8-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (13.0 MB view details)

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

smooth-1.0.8-cp311-cp311-macosx_11_0_arm64.whl (908.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

smooth-1.0.8-cp311-cp311-macosx_10_9_x86_64.whl (962.9 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: smooth-1.0.8.tar.gz
  • Upload date:
  • Size: 22.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for smooth-1.0.8.tar.gz
Algorithm Hash digest
SHA256 5d11a03cd955d0b52300c2a3cdc1caee715777aa26e2f8d833bfe3160b5e214d
MD5 87becbfab5b8bef492e6e07a9a4d7147
BLAKE2b-256 0bb188b5a9da4b4f4e1dcf3b9d7cf67690f9fe6669b23f08a0a30a22e8cdfaba

See more details on using hashes here.

Provenance

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

Publisher: release.yml on openforecast-org/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.8-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.8-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 09ac759d7412ad8bedb21810d95db766d89a411e757f2cf22fc05aa52f9b18d5
MD5 a1e64f910b5bb6e5a49e10233c5fd350
BLAKE2b-256 68134d2fe67dca4ab850a35d34eec87b82828f64dd4e7dcaedcaee5aba9c1a7c

See more details on using hashes here.

Provenance

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

Publisher: release.yml on openforecast-org/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.8-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: smooth-1.0.8-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 13.8 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for smooth-1.0.8-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6aaf52b05d0e15b59c3bcf818a9b872bbf20e9434625997aabba5411a28d07e5
MD5 2fd01fd2774ae90abce98b8422246371
BLAKE2b-256 17a0e19e7de5fe84108b76d11f5cd79d60db97d3eec19181091e103254cad2e3

See more details on using hashes here.

Provenance

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

Publisher: release.yml on openforecast-org/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.8-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.8-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ba2f6d75e6d9cb6bb46ab39d588acddd84e2a183fa1f685127172a481469f53c
MD5 b18767d8a1754bd1f946768061310709
BLAKE2b-256 e4f1fba4ef6c4358b34a5d4aaa01b4a1ccd7863573dac3a41b0ce85cd0c816a6

See more details on using hashes here.

Provenance

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

Publisher: release.yml on openforecast-org/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.8-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for smooth-1.0.8-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f5c17ef66e67dbb19b1383b716f4d3852fdd4e9219e91bdc73572467acf93b14
MD5 f1306e1eacaa4a90b6d83fabc1a48583
BLAKE2b-256 6bb011f3941c74bb6c05f05154153face4ec8f9e46e5678b589999fa258d1c9d

See more details on using hashes here.

Provenance

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

Publisher: release.yml on openforecast-org/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.8-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.8-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 b4cfcd9bfd5dd07ff48ad5f1e2a70aeb8ffb4c96b826cb78a2bad3227007c3f3
MD5 50ef2d95cfe912fa4867cdb0e0d14c26
BLAKE2b-256 7945379fd553ba1ca0e8c571cb16430935c2331594b6f61976531a8a19a6905d

See more details on using hashes here.

Provenance

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

Publisher: release.yml on openforecast-org/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.8-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: smooth-1.0.8-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 13.8 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for smooth-1.0.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4018988c41352c59a6f97e2a8906a59bb543cf96e385d3e9be3f91d67802eda0
MD5 477254ccd77d56c4741f273c457b1d5e
BLAKE2b-256 f2b0dd3292fbea743b5f6408d0049f8ec53f4f9aed385b60f708658d124bac82

See more details on using hashes here.

Provenance

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

Publisher: release.yml on openforecast-org/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.8-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.8-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1f1d6e7fad2366a0c786481138fa36a2a8f39eb660158318168778177260570e
MD5 aca78e1f56416321a4de64dcf96b3dce
BLAKE2b-256 1f7044281e9a79d04d77e9cca3b4289ea3ed794cf164a0fb29bcd0383197d9a4

See more details on using hashes here.

Provenance

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

Publisher: release.yml on openforecast-org/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.8-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for smooth-1.0.8-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b4c6e5fb68e36982a114894e8a5e3a32af8d648be361fdd47c9ddf0fffb8bf76
MD5 f501349fc3881176dca051d804a8805f
BLAKE2b-256 d2c6e687ffabd64554aaf203764c528314d10bb575e1ba00349bdd0e3f3a501b

See more details on using hashes here.

Provenance

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

Publisher: release.yml on openforecast-org/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.8-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.8-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 d6b2a7119b00d59c16891c443e8405048671839140fb8f5aacf316d739185d96
MD5 2775d4d1d3ca36ea766ca047faa5164b
BLAKE2b-256 28563a160c6b15858bcca231052350d4efdf93a829e205b46501cd272595ee9e

See more details on using hashes here.

Provenance

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

Publisher: release.yml on openforecast-org/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.8-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: smooth-1.0.8-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 13.8 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for smooth-1.0.8-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 47ccc167c7316fc274e6a1741eafaa4ad39079e0485d55edc296113a411cbd8e
MD5 004e53d71554cd0b9e0c63bfe7a80819
BLAKE2b-256 e9c12c826f9595355d9cc1619eb4d90b4e92d134fc075eb2e358bd9317bb5125

See more details on using hashes here.

Provenance

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

Publisher: release.yml on openforecast-org/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.8-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.8-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 edf202101bf38884cd19aeb78d9c5d28ebe55f7992a7036139ba6e095ec23a97
MD5 1e37192fc6982315bfb8bb2395e370f8
BLAKE2b-256 d8dd9158c384e2fcd387cda126d0bc790826ecb1b4aca1b748cee00c81904602

See more details on using hashes here.

Provenance

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

Publisher: release.yml on openforecast-org/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.8-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for smooth-1.0.8-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1bebe09b210b4bf3de6ca557aa168fc3adf2d04204febdffe8142a968f955b51
MD5 4568d2f51b49b432acc849123e61c9ad
BLAKE2b-256 edc92d2249db5b40aed809f6c00ac5ea0e24b8fe4a3a96d34181d108d15c14a8

See more details on using hashes here.

Provenance

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

Publisher: release.yml on openforecast-org/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.8-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.8-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 81cc3670ea98e3d8b304df78da65e2bbe320d1c0d2e7e1c403b55c4fe418e37e
MD5 8552c743acc2bd3f89ebd04094565a8d
BLAKE2b-256 e46efff505da08216d6f453c141e70fa21d9a7899b95adc1047121298c983ef3

See more details on using hashes here.

Provenance

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

Publisher: release.yml on openforecast-org/smooth

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

Release history Release notifications | RSS feed

This release

1.0.8 This release

14 files

1.0.7

14 files

1.0.6

14 files

1.0.5

14 files

1.0.4

16 files

1.0.3

17 files

1.0.2

17 files

1.0.1

17 files

1.0.0

17 files

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