Skip to main content

Python's forecast::auto.arima equivalent

Project description

pmdarima

PyPI version CircleCI Github Actions Status codecov Supported versions Downloads Downloads/Week

Pmdarima (originally pyramid-arima, for the anagram of 'py' + 'arima') is a statistical library designed to fill the void in Python's time series analysis capabilities. This includes:

  • The equivalent of R's auto.arima functionality
  • A collection of statistical tests of stationarity and seasonality
  • Time series utilities, such as differencing and inverse differencing
  • Numerous endogenous and exogenous transformers and featurizers, including Box-Cox and Fourier transformations
  • Seasonal time series decompositions
  • Cross-validation utilities
  • A rich collection of built-in time series datasets for prototyping and examples
  • Scikit-learn-esque pipelines to consolidate your estimators and promote productionization

Pmdarima wraps statsmodels under the hood, but is designed with an interface that's familiar to users coming from a scikit-learn background.

Installation

Pmdarima has binary and source distributions for Windows, Mac and Linux (manylinux) on pypi under the package name pmdarima and can be downloaded via pip:

$ pip install pmdarima

Quickstart Examples

Fitting a simple auto-ARIMA on the wineind dataset:

import pmdarima as pm
from pmdarima.model_selection import train_test_split
import numpy as np
import matplotlib.pyplot as plt

# Load/split your data
y = pm.datasets.load_wineind()
train, test = train_test_split(y, train_size=150)

# Fit your model
model = pm.auto_arima(train, seasonal=True, m=12)

# make your forecasts
forecasts = model.predict(test.shape[0])  # predict N steps into the future

# Visualize the forecasts (blue=train, green=forecasts)
x = np.arange(y.shape[0])
plt.plot(x[:150], train, c='blue')
plt.plot(x[150:], forecasts, c='green')
plt.show()
Wineind example

Fitting a more complex pipeline on the sunspots dataset, serializing it, and then loading it from disk to make predictions:

import pmdarima as pm
from pmdarima.model_selection import train_test_split
from pmdarima.pipeline import Pipeline
from pmdarima.preprocessing import BoxCoxEndogTransformer
import pickle

# Load/split your data
y = pm.datasets.load_sunspots()
train, test = train_test_split(y, train_size=2700)

# Define and fit your pipeline
pipeline = Pipeline([
    ('boxcox', BoxCoxEndogTransformer(lmbda2=1e-6)),  # lmbda2 avoids negative values
    ('arima', pm.AutoARIMA(seasonal=True, m=12,
                           suppress_warnings=True,
                           trace=True))
])

pipeline.fit(train)

# Serialize your model just like you would in scikit:
with open('model.pkl', 'wb') as pkl:
    pickle.dump(pipeline, pkl)

# Load it and make predictions seamlessly:
with open('model.pkl', 'rb') as pkl:
    mod = pickle.load(pkl)
    print(mod.predict(15))
# [25.20580375 25.05573898 24.4263037  23.56766793 22.67463049 21.82231043
# 21.04061069 20.33693017 19.70906027 19.1509862  18.6555793  18.21577243
# 17.8250318  17.47750614 17.16803394]

Availability

pmdarima is available on PyPi in pre-built Wheel files for Python 3.6+ for the following platforms:

  • Mac (64-bit)
  • Linux (64-bit manylinux)
  • Windows (32 & 64-bit)

If a wheel doesn't exist for your platform, you can still pip install and it will build from the source distribution tarball, however you'll need cython>=0.29 and gcc (Mac/Linux) or MinGW (Windows) in order to build the package from source.

Note that legacy versions (<1.0.0) are available under the name "pyramid-arima" and can be pip installed via:

# Legacy warning:
$ pip install pyramid-arima
# python -c 'import pyramid;'

However, this is not recommended.

Documentation

All of your questions and more (including examples and guides) can be answered by the pmdarima documentation. If not, always feel free to file an issue.

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

pmdarima-1.8.0.tar.gz (1.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pmdarima-1.8.0-cp38-cp38-win_amd64.whl (616.1 kB view details)

Uploaded CPython 3.8Windows x86-64

pmdarima-1.8.0-cp38-cp38-win32.whl (557.7 kB view details)

Uploaded CPython 3.8Windows x86

pmdarima-1.8.0-cp38-cp38-manylinux1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.8

pmdarima-1.8.0-cp38-cp38-macosx_10_15_x86_64.whl (610.5 kB view details)

Uploaded CPython 3.8macOS 10.15+ x86-64

pmdarima-1.8.0-cp37-cp37m-win_amd64.whl (609.6 kB view details)

Uploaded CPython 3.7mWindows x86-64

pmdarima-1.8.0-cp37-cp37m-win32.whl (551.9 kB view details)

Uploaded CPython 3.7mWindows x86

pmdarima-1.8.0-cp37-cp37m-manylinux1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.7m

pmdarima-1.8.0-cp37-cp37m-macosx_10_15_x86_64.whl (604.9 kB view details)

Uploaded CPython 3.7mmacOS 10.15+ x86-64

pmdarima-1.8.0-cp36-cp36m-win_amd64.whl (609.7 kB view details)

Uploaded CPython 3.6mWindows x86-64

pmdarima-1.8.0-cp36-cp36m-win32.whl (551.7 kB view details)

Uploaded CPython 3.6mWindows x86

pmdarima-1.8.0-cp36-cp36m-manylinux1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.6m

pmdarima-1.8.0-cp36-cp36m-macosx_10_15_x86_64.whl (604.7 kB view details)

Uploaded CPython 3.6mmacOS 10.15+ x86-64

File details

Details for the file pmdarima-1.8.0.tar.gz.

File metadata

  • Download URL: pmdarima-1.8.0.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for pmdarima-1.8.0.tar.gz
Algorithm Hash digest
SHA256 65f22f49ebc2271934a2bb346a6667b19094300eeaebf93a3674577c5440a6bc
MD5 e5751f3bd510062e38729bd8e4b9ddab
BLAKE2b-256 9819f602cd4f0de3088fe5f4e81a53ea17cb758707dce927ca624471b27c1cf2

See more details on using hashes here.

File details

Details for the file pmdarima-1.8.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pmdarima-1.8.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 616.1 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for pmdarima-1.8.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 394d220f65ed3a26cb4554323e7c4c6b88922fe283f912255844fbe14dff5b32
MD5 cf090c34d872e7e170e7db6d6197e3f0
BLAKE2b-256 995877fc22ad96ad80e30b55780fa7e865a3144df13b3182b7e47588a3292447

See more details on using hashes here.

File details

Details for the file pmdarima-1.8.0-cp38-cp38-win32.whl.

File metadata

  • Download URL: pmdarima-1.8.0-cp38-cp38-win32.whl
  • Upload date:
  • Size: 557.7 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for pmdarima-1.8.0-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 3df67baa9ac64cbdf96ba0b4a4bc24507bce02b93411afeb857e26abd2385a56
MD5 660657d9a9ebf84cbc791998d0a85c49
BLAKE2b-256 ace45fc22a0ca9c5cbf553b260d1812bd9644e52a56d4b80ebf27f3aee1937ab

See more details on using hashes here.

File details

Details for the file pmdarima-1.8.0-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: pmdarima-1.8.0-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.9

File hashes

Hashes for pmdarima-1.8.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 fa4110707e7cfbd9966ce3ef856db4d8f916d34aa668fb9281e424e9a98c22d8
MD5 b06b479d155f338b37c5189f6eab19b6
BLAKE2b-256 a1e51186c40c497a3212c91e22417af0fb2a19d873db1e570804465970743735

See more details on using hashes here.

File details

Details for the file pmdarima-1.8.0-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: pmdarima-1.8.0-cp38-cp38-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 610.5 kB
  • Tags: CPython 3.8, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for pmdarima-1.8.0-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 0e4dc0fe42fbfce7822b5f0e56e46b7fb89f2d6ce4eb7da5fa4fefff6983a841
MD5 5c0143c13acaeb8a3e6519cdb105e7b3
BLAKE2b-256 c2b52d669df995c5495de88acf89a7b0c58c776f943fba5af41ed915bbe52ea3

See more details on using hashes here.

File details

Details for the file pmdarima-1.8.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pmdarima-1.8.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 609.6 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.9

File hashes

Hashes for pmdarima-1.8.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 524b51f9cc3997ec2ffc66b30c3a97dc6e14e7fad72905a2c8830360d30d45cf
MD5 b5e1708ce61195d3d934f90281625d8a
BLAKE2b-256 d3b80295767de22ac446faa0fa596e06112eedb498f897682dd338fb4bf035c2

See more details on using hashes here.

File details

Details for the file pmdarima-1.8.0-cp37-cp37m-win32.whl.

File metadata

  • Download URL: pmdarima-1.8.0-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 551.9 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.9

File hashes

Hashes for pmdarima-1.8.0-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 f02aae7f79dfe2e7605db586d4b5683d5ef2587efaf1273a2b8a37966733a892
MD5 b46f684d293886f84d440c93001a6907
BLAKE2b-256 eff8d6e2d9b8300202b92579501a3d029f160a964bbde138228637d5d5785f37

See more details on using hashes here.

File details

Details for the file pmdarima-1.8.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pmdarima-1.8.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.9

File hashes

Hashes for pmdarima-1.8.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d39e4251ffdc78f90b4dac2ba5c5a2222eea43a7548f35cdccd10b044d042eb2
MD5 3b9331e84878c168f4e5bacbedb72449
BLAKE2b-256 e4a8bdf15174e35d072e145d16388b1d3bc7605b752610170cb022a290411427

See more details on using hashes here.

File details

Details for the file pmdarima-1.8.0-cp37-cp37m-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: pmdarima-1.8.0-cp37-cp37m-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 604.9 kB
  • Tags: CPython 3.7m, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.9

File hashes

Hashes for pmdarima-1.8.0-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 f9c13f124a4f2996c544463cd651a668a65c5c390f85e25a76110c4836fa4182
MD5 db1b4ee38bcad18b065d7cf30496bcc5
BLAKE2b-256 55c456ed92b4a3bce44684656c6f995445617c920eb8fa52fa8b09bccf5c04df

See more details on using hashes here.

File details

Details for the file pmdarima-1.8.0-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: pmdarima-1.8.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 609.7 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.6.8

File hashes

Hashes for pmdarima-1.8.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 582ad6644a9eebde47739aa1152ccc812b530b2ce4fd32d1685442ac0c57396d
MD5 718f48bfa711b285d2ea426f3a8d9e55
BLAKE2b-256 c14a7593e2f99281329067cec3f3e6c343033dd15bd0718c7ab0c52ef0c78ac9

See more details on using hashes here.

File details

Details for the file pmdarima-1.8.0-cp36-cp36m-win32.whl.

File metadata

  • Download URL: pmdarima-1.8.0-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 551.7 kB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.6.8

File hashes

Hashes for pmdarima-1.8.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 01a96b4c014646c2bfe57cbecf2f75ccd99e417badfa9c28fd1c0f3506ad0eb1
MD5 7677adcec892f8d532fc8f2a3c132f3c
BLAKE2b-256 19209633d13b86aef285bc22817179566b7683a6a08beab80aa7fbadf9bf7a66

See more details on using hashes here.

File details

Details for the file pmdarima-1.8.0-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pmdarima-1.8.0-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.9

File hashes

Hashes for pmdarima-1.8.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5fbd363bbfe6dd4f35c1825f53ae07e63d3ca1995ac3e87bef0359c1670c464b
MD5 5232c1e597ac1d4fa6de8a42d36fb5c5
BLAKE2b-256 c9d761af1897449638822f97c8b43ef0c2fce2ec68a6cda9a43ebbbdd12b967c

See more details on using hashes here.

File details

Details for the file pmdarima-1.8.0-cp36-cp36m-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: pmdarima-1.8.0-cp36-cp36m-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 604.7 kB
  • Tags: CPython 3.6m, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.6.12

File hashes

Hashes for pmdarima-1.8.0-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 0377023997c4424586d4f5d207a455a3fbba6f5fda41d89eb135a5f697375dcd
MD5 418e45fe1c3bd9d19719725c41f08884
BLAKE2b-256 2d5aef35dc12e369fd7f1f25178fa4e11ca67cad816fd603b4ee735e0254cb7f

See more details on using hashes here.

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