Skip to main content

Python version of the smooth forecasting library

Project description

smooth

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

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.3.tar.gz (12.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.3-cp313-cp313-win_amd64.whl (590.6 kB view details)

Uploaded CPython 3.13Windows x86-64

smooth-1.0.3-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.3-cp313-cp313-macosx_11_0_arm64.whl (563.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

smooth-1.0.3-cp313-cp313-macosx_10_13_x86_64.whl (596.9 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

smooth-1.0.3-cp312-cp312-win_amd64.whl (590.5 kB view details)

Uploaded CPython 3.12Windows x86-64

smooth-1.0.3-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.3-cp312-cp312-macosx_11_0_arm64.whl (563.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

smooth-1.0.3-cp312-cp312-macosx_10_13_x86_64.whl (596.8 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

smooth-1.0.3-cp311-cp311-win_amd64.whl (589.0 kB view details)

Uploaded CPython 3.11Windows x86-64

smooth-1.0.3-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.3-cp311-cp311-macosx_11_0_arm64.whl (565.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

smooth-1.0.3-cp311-cp311-macosx_10_9_x86_64.whl (595.3 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

smooth-1.0.3-cp310-cp310-win_amd64.whl (586.4 kB view details)

Uploaded CPython 3.10Windows x86-64

smooth-1.0.3-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.3-cp310-cp310-macosx_11_0_arm64.whl (562.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

smooth-1.0.3-cp310-cp310-macosx_10_9_x86_64.whl (591.3 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: smooth-1.0.3.tar.gz
  • Upload date:
  • Size: 12.1 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.3.tar.gz
Algorithm Hash digest
SHA256 58eb96d1434ce31c04d25de0369ba8c616f094e85e4a4503eb350d6e98e514e7
MD5 49871fd94bef04313effd8ebee1cf9b0
BLAKE2b-256 0e206d36f108fc7db756538ee49d08b95f952610ea0c062a69924871b46057b4

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: smooth-1.0.3-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 590.6 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.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 31cdd0ac41b811ed2c479dc8b6b097776ff9d35691a19923c09996135baeba80
MD5 3403af4d872b8ee1e226f9385afe6db3
BLAKE2b-256 3464c335e97239901de6ab9c32a7f6b3ef3465202b5e7cac3c6886568a52f320

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 d68b30c29fb9d6c55dc286b6738257855c14d898779d458a64f946d101c74d1c
MD5 420deafd36b6dba532c405f1fac21bb7
BLAKE2b-256 07665305e923c01a6fcf511776fd1a66ff1c006eaee86cc7bc467401d98a1339

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 48702d4869ae0373bb7d90316b1451b02628364361b3e878c5fc1176c732b9de
MD5 7f53841ed59e68c638abcd3ae62814ac
BLAKE2b-256 2ca035094903ee699514d63027bcaa22ab16ef2120e23dab00776b25d30c2fb0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.3-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 5a77af324f35692429af9f2ed7dd68e5b2188e8d80fd5a76087c6fe4deee25a4
MD5 9d4dcacc341db557fa417b6da24b1de7
BLAKE2b-256 483fa42514019611c61a633fdf95fca6641d1c9d0670f532503c06481fb882bc

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: smooth-1.0.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 590.5 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.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e04ac6d39dfad6d0c95954e2646a8b9190c2169fe9227dde0dbdaaf4292d29e0
MD5 106a9f1c16d243e7b2a29ea868dbbe27
BLAKE2b-256 ecd01a61ec56c30a4871bac5ad37c3d1987204da2536a78dbe56f3b70bb5816c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 4865c5cbec5df4e5ed249d17b168a2d6401cf36b5964f153131ad01ad46e6f10
MD5 e1cdd4fe4bc476c3aabd4b3d7b45ffc0
BLAKE2b-256 1a41e16b3b6c112ea2f3db49b244670ccbddec2ec8dec3ef1cd6c7cd6d351438

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5b7f57a1b83f813a497cea73e9e3f410962c88a7cac4e8e3bd2993fa59a4fdf4
MD5 e9edb225fdfb0a1df49538ad3ad3266e
BLAKE2b-256 3ab736b69dfe52b0bd1e79c3465060a2962d1e75b5fa5efe8547e4289dc18a8a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.3-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 7d4b21f8469c104e72f7ef6bc552ff1c0568fef298728b8ef38430e416d57b55
MD5 374e458ae7ba312a11e0edae0a5d94a1
BLAKE2b-256 019561e393202956687316f00199685e2f3ba4a92b52bbd8e2f6ed8afac855ab

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: smooth-1.0.3-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 589.0 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.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 31cf9df0e91ae2ad764709446767e9716a11a23cd2033ab20968a997331b7f15
MD5 7436f96d18e642021c7d7b35abcb7293
BLAKE2b-256 820e8a14d159e4d2daf089ce4e743bacbf737d1c7b2c1e95d6a176c863357ee5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 8c4dadf8c0a8e520abffc2976fa194d03199530a5f3637528a57f7a139909295
MD5 89b0384d746eca7c32c27bd0d77b962d
BLAKE2b-256 eae688cb5ab404ef1aac1bbe6d054421c9e768228dcc2f22ccbc1ba45f162ebc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7738d064d021edea8433ce1ed724d701160dd6b6805f24acabbedf8d3e1043ff
MD5 7a480b6578491719dd088275c00ed233
BLAKE2b-256 95ea1572e3b3bfe08e929daf370419b8c473c36d45966b54991a408f3419617f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.3-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c371ebc5d92ffa7e2bff8d530303f02b35dce01559eaba13aed7a9b2231e09bd
MD5 f1348f0d88f011ead7724883e72be936
BLAKE2b-256 ad75532b3aec4d003d29a76d83443f5c9200bae6e500b17f2fdc953a5eb21b5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.3-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.3-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: smooth-1.0.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 586.4 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.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 aa406a4f9bdf2117657f23b46d38151c93e2cf1d87ef457f7bb7d1750a6d66e8
MD5 542bf6816b87d3cba767e555dc9e9d01
BLAKE2b-256 e28752a756d95de54c1728f71a8462b1e8caf77a0979287aabfb4555720dc660

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 53f2f56ac8bed6c6fe25327a66b7f281d929bf8ca2eed3894262d575d6aa3ca3
MD5 7d7c1983f2332ccfbed8c21a35d1e01c
BLAKE2b-256 857507ab2c434b137fe59c6b716158bfb325cb9138fca83fa7984a31275fa78f

See more details on using hashes here.

Provenance

The following attestation bundles were made for smooth-1.0.3-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.3-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for smooth-1.0.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 57be4c3227144b60312df72b9744b4bf3a9635a586e80490d363f0674e1f2bdb
MD5 3306ae3bf7fdcefda409feef7fcc1fb6
BLAKE2b-256 4fe53d776080065907b2a1228064f88c4f06072830430a71b243efb1d8835337

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 62cd3dc593fc876a630b154ed0bdbda669ec642ce47f2ac391d4afb56be559cd
MD5 eb6aeed406e9e87958d25416dd08c69c
BLAKE2b-256 294aaa03f3262bc9e6e48c951f4650021c1155d5817b7ce97331979ffc98b099

See more details on using hashes here.

Provenance

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