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

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

Uploaded CPython 3.13Windows x86-64

smooth-1.0.2-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.2-cp313-cp313-macosx_11_0_arm64.whl (519.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

smooth-1.0.2-cp313-cp313-macosx_10_13_x86_64.whl (549.6 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

smooth-1.0.2-cp312-cp312-win_amd64.whl (544.1 kB view details)

Uploaded CPython 3.12Windows x86-64

smooth-1.0.2-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.2-cp312-cp312-macosx_11_0_arm64.whl (518.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

smooth-1.0.2-cp312-cp312-macosx_10_13_x86_64.whl (549.4 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

smooth-1.0.2-cp311-cp311-win_amd64.whl (542.7 kB view details)

Uploaded CPython 3.11Windows x86-64

smooth-1.0.2-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.2-cp311-cp311-macosx_11_0_arm64.whl (520.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

smooth-1.0.2-cp311-cp311-macosx_10_9_x86_64.whl (548.4 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

smooth-1.0.2-cp310-cp310-win_amd64.whl (540.2 kB view details)

Uploaded CPython 3.10Windows x86-64

smooth-1.0.2-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.2-cp310-cp310-macosx_11_0_arm64.whl (517.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

smooth-1.0.2-cp310-cp310-macosx_10_9_x86_64.whl (544.1 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: smooth-1.0.2.tar.gz
  • Upload date:
  • Size: 11.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.2.tar.gz
Algorithm Hash digest
SHA256 431ef634104cd281a19d9fd0fc614222f838d5856d71fecc67b50c4554d187fe
MD5 b975e6b529f63d8e8b86b3a4e6aa2244
BLAKE2b-256 69825fd447c86a59aa1c81aec0b8d0349dfcad6319407a6e5ca9c47b746f5ee2

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: smooth-1.0.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 544.1 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.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 10bae67e19ecf1e1698bd750d5a882d1622a60a0af799161565bdc7bc7bf1e64
MD5 815b50e7da44367d58b03d904bd0bd01
BLAKE2b-256 ea619bb45a883f110fddd939632e1dc899b815a039906cd20afa252a3723dc56

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 9918a19094d0969eccb62293c279ba0bfe88e0e7e23f478991837a1baaccf762
MD5 ca5702e169155ae29eea8b577765ef35
BLAKE2b-256 43b37b747de1410c87887504ce2b4d3f59309950c2bff7167101abf6c1fa2aad

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0ac937430d18d9a451c566998db8974dc1dd7c6edb7835ec432e2e78ea58978c
MD5 cb0ee88ac50328e4dc13bf7870b4917c
BLAKE2b-256 f45d745f91e5d60f33cd095c3454f37ead0a00454978967a10e4a5c6ccaec987

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.2-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 b3f87b7ce4ae3489bce417fb434b520780a76f492388662e3eb3c966cefbb4e0
MD5 e8f03e1c40589463b1aa0448dd3f2c83
BLAKE2b-256 e4d97bca186ae91ec811233b45288f14f4b2f10317c1a0409f4bfd69f059a8d2

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: smooth-1.0.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 544.1 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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c8262c1724b12fb2fb700f3ed6c15d4e1cada87b0636ceb989633ad8aec1170b
MD5 446ea8b7abe28f323470bfec97c194aa
BLAKE2b-256 51d41d97af0a8cb878df30af0818fc2dfa2f8c9716714ca31c96e5d4eed12d91

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 0568a110365bb1fc8f927ac7a9d285f894d96c145c2c73f52a8de8c4cb2cd6a6
MD5 24e4c5ec3d2c72de429dd6b18911e79c
BLAKE2b-256 27bbcdc51bccbc497120991d1dbc28b08a137ff713119cd8b3f234b8ceec3eab

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5f43ed4d75527d569267fd3d7d3efe621c12e21add2378ff505c679f8ce05a23
MD5 d42f75f71a0b139f6ae6846909fc893a
BLAKE2b-256 661fbacad90fbfe496e2495920fdfdbcc02938d3d9f23746b50917f141cbf556

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.2-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 80defcbe34faf7530e53591a104ee3c3c583d002f18d12f717557ff4185a87f5
MD5 a6e9022fea9f35cc7f0a9a32aadcde7c
BLAKE2b-256 f878a16a104481d235ffd0c2d58d52669c5bda233f99f4e77f07620a63b0f52e

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: smooth-1.0.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 542.7 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.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f8821b0fc1f5d1972fb4bb6f71488e4d394fbc1c5b82c3cabf23f512a9977844
MD5 a70ca15a32107f70428ec71ab9c7f5cc
BLAKE2b-256 3468285e3fa1d1fd842fafed0359b80ca37fff3b7b979de00e59c698566b7d4d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 c9060b6feb84e1f6d47602947bcc4c99439d3ffe87cfb19bc7b5e4e3b4cc5a13
MD5 98133ed6930d3f102c86691b7e9f66eb
BLAKE2b-256 3a78e143dcb9568b9411fb5b9dfb876c33d0a64f99d308980d8203e883a0e24d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cd96240f67cb429e6cef0c0a095360b758bedb233423ff30d6aa1ff1e6ebab44
MD5 55e5635352a92ebae7e027c2f3362d28
BLAKE2b-256 17de96d567eaaeffec1aaa62f550432944b4f4b2b0efceaa0d96a6020e49527a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 747d5db483f8ea04e36b8b3536567ebdd9e23cef86c74223715a562f2119ee31
MD5 b7146d9fc6e39a1b617a105ea188c6e2
BLAKE2b-256 894246a482fc1b8764b55a80ca7673447f441f5227c40bc54445efc628a82a04

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: smooth-1.0.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 540.2 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.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fdaf10a81547de811c3881afa6237f62d8dbe3d49bc66c99413d8991850f7186
MD5 0643b3a00f33d48f52df0721f122df87
BLAKE2b-256 0c5108fb85b989477a82adb5bb0bb8dc0d4ab61533d1c6d0823c3f070869d710

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 08a4e40e87cecdd7760330c12eee1986d72d8f5095a382559b0dc50cd79f6f79
MD5 b9d18c4c06b41756e4877dc061bcc985
BLAKE2b-256 bcdfb92757f59d57343102437edac7713784e2abfe25d557f6d925542727ed8c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 89e4e692d09efa9cf04b88b1c628c3fbf27d26ff87d0633251aff0337b762d32
MD5 4cd3c6fc54c348274c7d6c72b9c77c07
BLAKE2b-256 490fc6e1bc3d1f431e6ee54107b701e3f1b2f1620c072abb8776913521c182e0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for smooth-1.0.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 85e8d172f94e13a33aad92ea1f25541ff79dbb265f09074275ba956d438afe8a
MD5 df98c7d8d8e4e0843deda90a999f2a5e
BLAKE2b-256 aa36326784cca99e9be72f9f222032f58288f91e8a0e8615e4aa3959ced93ea6

See more details on using hashes here.

Provenance

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