Skip to main content

Python version of the smooth forecasting library

Project description

smooth

PyPI version PyPI - Downloads Python CI Python versions 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.

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).

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

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

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.1.tar.gz (11.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.1-cp313-cp313-win_amd64.whl (542.9 kB view details)

Uploaded CPython 3.13Windows x86-64

smooth-1.0.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (11.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

smooth-1.0.1-cp313-cp313-macosx_11_0_arm64.whl (517.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

smooth-1.0.1-cp313-cp313-macosx_10_13_x86_64.whl (548.4 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

smooth-1.0.1-cp312-cp312-win_amd64.whl (542.9 kB view details)

Uploaded CPython 3.12Windows x86-64

smooth-1.0.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (11.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

smooth-1.0.1-cp312-cp312-macosx_11_0_arm64.whl (517.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

smooth-1.0.1-cp312-cp312-macosx_10_13_x86_64.whl (548.3 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

smooth-1.0.1-cp311-cp311-win_amd64.whl (541.5 kB view details)

Uploaded CPython 3.11Windows x86-64

smooth-1.0.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (11.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

smooth-1.0.1-cp311-cp311-macosx_11_0_arm64.whl (519.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

smooth-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl (547.2 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

smooth-1.0.1-cp310-cp310-win_amd64.whl (539.0 kB view details)

Uploaded CPython 3.10Windows x86-64

smooth-1.0.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (11.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

smooth-1.0.1-cp310-cp310-macosx_11_0_arm64.whl (516.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

smooth-1.0.1-cp310-cp310-macosx_10_9_x86_64.whl (543.0 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: smooth-1.0.1.tar.gz
  • Upload date:
  • Size: 11.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.1.tar.gz
Algorithm Hash digest
SHA256 a47da448ab8d3a74985e9e383d085ed40258a8436bfc88d0bd28286d750db1d2
MD5 92627152198ace80658c9b3520af3c4f
BLAKE2b-256 9c48725371c6c49ddee5f3d875385ddafa27efccb03c95d6a063c5fd8493c21d

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: smooth-1.0.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 542.9 kB
  • 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.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 58878274f7f0925d8598e5fb8276262cbf6a35942378f8039bff60621c99ed57
MD5 f5cef9c5b53de51660c5ac62638da62f
BLAKE2b-256 7004ad26810a8f32d05b6c783e3f6cb54dba8cdec787a6caea90ad73bbbbc95b

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.1-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.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 403a5de2922afe6cdacb054bd6e36e445edec4da83765d5b7fd16e397026d0e0
MD5 1004ea91a020c5292981ea528741a72b
BLAKE2b-256 2a3487f72fcb93a72f72dc9078e1c7bfb6d2d43950d0d57fed24d221bce44deb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2a459a7f2c2064e3d66440b28a04051b9eee888aa3731386045694deaf04b40e
MD5 cbb6d09c21d87b512114746b1db26ed1
BLAKE2b-256 576e8d4203353c97a966787432c4d38673011b4caf90c277b25442ff9f00848d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.1-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 9af49702048f97b97c03baa247bb5fddb21e7086ec0a83ca57d2945f1be0f5d8
MD5 e58de76e3a7e65a33893367a28b44726
BLAKE2b-256 0691aaa1710848d8fa4934a5d0dcb70a19b928a790c995c6c0bf2c2584c784c3

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: smooth-1.0.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 542.9 kB
  • 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.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 dbcd8f3f07e90be83f5aa802ffc0bd5bb65a648ffff4840336bc3d015d2f9701
MD5 7b24d9c69391a2dc1995c05dc17afcd3
BLAKE2b-256 5a18dfa0b9abeb8c7aa413fd29c07e4fb996633e284f88fdc55fdaf95c44dc0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.1-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.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 3dc82520fbae11d67952b78359ce0139b6e02b0389347b265655ef08e723bd10
MD5 b05849a0a1105b713f892f60de59c964
BLAKE2b-256 042ae763a8fb03b74bd43eb8e1e2827bcd85fb251f1127ffac3b9130dbaf1249

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bc9445c6f31e4d7fc26edac8293ddd6922ef441342407e35e8b8c572fd66dcab
MD5 5317dcc31134174dd77f9ef07e793078
BLAKE2b-256 156a579d1811e7f04cfcf79c3d3494bc5707055d000ad50fc9b69780a9a8f627

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.1-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 17d10864330c177a85305f92a1212888771f126dba08f7d52f29b963e52d0318
MD5 6d7bb36fc85cd47ad5faac372267b001
BLAKE2b-256 6696b5e2f96938dc140a4231b699b4f3bc06b7bf79d7be9f68684d3a618d1365

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: smooth-1.0.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 541.5 kB
  • 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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7a25404fa344b64029f8ff389f8c4dcd4c35e1326ae583a31f9b61c9f5162068
MD5 d4195451d67940022c067a56a7a61e74
BLAKE2b-256 64213c5eda6b4b564e67e291e059300817735af49709859d89b1442ff23e6ad5

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.1-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.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a86da83c43cbf9d48ee936ca9287aa3c751737fdc3629ff6a8260309da8ba1f2
MD5 dac16120848b43bfbeb780b96269726d
BLAKE2b-256 bbba980894a50e56718f9202232ae288376037d0afc67c5e5eb73e4d19e7c1f5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 22fa88dd9786f29178e0d7cf2f24f831e8d6ade03fc2f8c0c34cc41dfae7f35e
MD5 67bb59d4e883a0a1c4f0e706be69ca92
BLAKE2b-256 bff11a48624f3d870df493f516ebc87c26d7c2ea5269d853f49507d607cd58f7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3dd4896659e8a69c36251bf64f87b0befe2c73dbc8c462dcdf1be86b16eaa33e
MD5 abcf4a08a0acbc53b80524bbed276f48
BLAKE2b-256 4265bffcff6a272ec110337aeb3461b8a0401cb4632e20dbff4222c2a4b4905c

See more details on using hashes here.

Provenance

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

File details

Details for the file smooth-1.0.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: smooth-1.0.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 539.0 kB
  • Tags: CPython 3.10, 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.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7bcd1ed770c41f116ce712eac4bd15f75d9e8dde00b71f6db99a067dfda8c7ab
MD5 1a018943ee6ce9fcd91db623805a72bf
BLAKE2b-256 83dd5e48852536042c7154fc45f8938bcbb37b1c378f120bdbc38420ba433466

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.1-cp310-cp310-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.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 81fa15351c0de93249ccf651276d09438d05ed8237ec662dac9d9c10faeac78a
MD5 672e78f9cd6b86153e06ef995a9ad742
BLAKE2b-256 cc7cd4f424f9ebf7ff03e4d8d57897edce88f0357cbf7e407263646149377570

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_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.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for smooth-1.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 20011986ad360df1a8d0d548c2fbb3ba6dd82e9049ca38938ec799fa1337825c
MD5 bc188317fa85e39cb05cb1d68e2c4fb3
BLAKE2b-256 1cd81011863bc8a91d0b17176bec1b9e7cf99a79b5b5d519180a66d860a99653

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.1-cp310-cp310-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.1-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for smooth-1.0.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3d6d63768d4f42b51b96f9f7a155e5e261c14504de9e07a10eef7803f64e34c0
MD5 bcc8eb89459645bbd6e7e45a1d64931f
BLAKE2b-256 e4b53bf2b0f59c4325aaadd7be744f89477fe600c611aa37242ec5fba906d4ca

See more details on using hashes here.

Provenance

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