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

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.7.tar.gz (16.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.7-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.7-cp313-cp313-win_amd64.whl (13.8 MB view details)

Uploaded CPython 3.13Windows x86-64

smooth-1.0.7-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.7-cp313-cp313-macosx_11_0_arm64.whl (883.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

smooth-1.0.7-cp313-cp313-macosx_10_13_x86_64.whl (941.2 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

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

Uploaded CPython 3.12Windows x86-64

smooth-1.0.7-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.7-cp312-cp312-macosx_11_0_arm64.whl (882.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

smooth-1.0.7-cp312-cp312-macosx_10_13_x86_64.whl (941.1 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

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

Uploaded CPython 3.11Windows x86-64

smooth-1.0.7-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.7-cp311-cp311-macosx_11_0_arm64.whl (885.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

smooth-1.0.7-cp311-cp311-macosx_10_9_x86_64.whl (939.5 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for smooth-1.0.7.tar.gz
Algorithm Hash digest
SHA256 6423357e9020e2fe6f06409e64d079c742e324d09aca5b6735f90e42eb7444a7
MD5 ab2b4ecadd733bb20131c93fe3944593
BLAKE2b-256 bebf7fce58713554883005930c7c9803fd679a2fb7e7e8c136ff2ae1de6a73ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.7.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.7-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.7-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cac7058a0cb3a3a2dc24d07138da854dd3528d5b24df9681b672ff7b1bfa386f
MD5 eeb72b7f12ece42dd27f4d6b9cd5363e
BLAKE2b-256 5ae40f09657647299bbcde61d2ffb950f6b4c14a490778fa0f412787e13ccec0

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.7-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.7-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: smooth-1.0.7-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/6.1.0 CPython/3.13.14

File hashes

Hashes for smooth-1.0.7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 58ee49a447212e9b51f419f16e77317ef89f8c62f0f1cfd10974c82c0edaaa7d
MD5 c030c1cadff974d41c1b8c837f051762
BLAKE2b-256 82cdf0924f35097d7627e4841e72481b439345c5600914714f1efa9bf09778e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.7-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.7-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.7-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d0005b82747e7e2cb23e8ac21f1b167e2058b8695bf2617c3525e299c2f16b4a
MD5 24afe9fb17f58ffbe82709d7813156d8
BLAKE2b-256 42e1c7bf7d41a93c62c708ee6f3150b05c7ed1b4b08c8bbdcdced30c664ce1ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.7-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.7-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for smooth-1.0.7-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8fa28d0d37e6902b911d2b1a52f76153faef385bd709ae0816544bd9f59ef09c
MD5 3eb28d6a3c2007153c2ab5a813bbb0f4
BLAKE2b-256 0d16873605b9dfa75ea5ffc30c77aaf17bd2aaa2c09be0f65027177f30205c6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.7-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.7-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.7-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a5f15871e89d8714cfde76d42e5270fca9811d05604fd3866f67162cb35a8ca0
MD5 eafde229ac5dc38a397f8722364a61ef
BLAKE2b-256 0d63262b2e901ed76ed453de5e50092ba55510581c1fc53b6f849d2477617800

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.7-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.7-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: smooth-1.0.7-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/6.1.0 CPython/3.13.14

File hashes

Hashes for smooth-1.0.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1a76e524cf388b36c179f4fff611398940952d8023d0054c570d4f860e814e56
MD5 3410f8dbf92c651cfa086b2214c3a031
BLAKE2b-256 953a82511f9be21661760c8de699982df15eab9344ba23bbcb0d02b696c1b950

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.7-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.7-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.7-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 363944a063eee849cdbd251604781bb5d28b86ebff3027ac964c7c324a59a55c
MD5 68ce0c2a04845296ef1ae06dc3020669
BLAKE2b-256 5979a3998d62603a8e86bed6435c7858cd547f9682ce651b088ea19f1c4d3a02

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.7-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.7-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for smooth-1.0.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a1ced7f0f1e3254fb9e2754bcc88482165e9a89454ae24e7ea796a40d0054115
MD5 ec163167ed0ebd5d5dfe8c399892ad35
BLAKE2b-256 17a10db28694cc5eef1b2664c6fb68834fdcf8133a078551da375d7b40c8d55d

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.7-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.7-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.7-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 b46da0f1fabf0bce6de2a7940107d30f364da2e98e4a1225e03449eb1ee04572
MD5 ace90ce6c980655af18853b006667b75
BLAKE2b-256 1f09cbcb014b5f142b052136164c130480e044bc83976a238e81e61200fd9338

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.7-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.7-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: smooth-1.0.7-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/6.1.0 CPython/3.13.14

File hashes

Hashes for smooth-1.0.7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 284f870f879905459e79859f4d03e79ad4ce76eef8964ac953c9473b3fda6aa9
MD5 816950a3bcc0276ac79951fe7d75be22
BLAKE2b-256 6539619e2e03321aafc0b5ad2827f2d04988ac18fd1ed1108794cc285b365b46

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.7-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.7-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.7-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e348a4a245111cd70b0779f13e0d7dc39d59a4887247b2e7c24c42df4aeea355
MD5 b99e4983ef8f3cce1dc83c066f01bb18
BLAKE2b-256 48f7807a88a03a86cc032f7e1ff93f951b696f407400f1c6be2d87e31b09285e

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.7-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.7-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for smooth-1.0.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f54d1022f07e29dc27fb283eea7d236bfa2f7d890cf1301a46e42a1389ac5f2f
MD5 163cffeb0531ee847619fdbc8e089d09
BLAKE2b-256 c2075196cb233884082c0cf4792e620268abb429b2fe88becc2cc591d0a8d714

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.7-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.7-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.7-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9936a3ac6674e4c3383d27b8e0394f1a61981ca8dff28cb8a0f7f4cefd216294
MD5 63fc531c588309154af3c689463dd43a
BLAKE2b-256 32006aea5d70717b235cdd26448bcded97d163489435772fbad6b302151e3a88

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.7-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

1.0.8

14 files

This release

1.0.7 This release

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