Skip to main content

Python's forecast::auto.arima equivalent

Project description

pmdarima

PyPI version CircleCI Build 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.5, 3.6 & 3.7 for the following platforms:

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

We have plans for the future for adding Conda distributions, as well.

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.5.2.tar.gz (1.1 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.5.2-cp37-cp37m-win_amd64.whl (583.6 kB view details)

Uploaded CPython 3.7mWindows x86-64

pmdarima-1.5.2-cp37-cp37m-win32.whl (523.6 kB view details)

Uploaded CPython 3.7mWindows x86

pmdarima-1.5.2-cp37-cp37m-manylinux1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.7m

pmdarima-1.5.2-cp37-cp37m-macosx_10_13_x86_64.whl (596.0 kB view details)

Uploaded CPython 3.7mmacOS 10.13+ x86-64

pmdarima-1.5.2-cp36-cp36m-win_amd64.whl (583.2 kB view details)

Uploaded CPython 3.6mWindows x86-64

pmdarima-1.5.2-cp36-cp36m-win32.whl (523.6 kB view details)

Uploaded CPython 3.6mWindows x86

pmdarima-1.5.2-cp36-cp36m-manylinux1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.6m

pmdarima-1.5.2-cp36-cp36m-macosx_10_13_x86_64.whl (596.0 kB view details)

Uploaded CPython 3.6mmacOS 10.13+ x86-64

pmdarima-1.5.2-cp35-cp35m-win_amd64.whl (563.4 kB view details)

Uploaded CPython 3.5mWindows x86-64

pmdarima-1.5.2-cp35-cp35m-win32.whl (511.8 kB view details)

Uploaded CPython 3.5mWindows x86

pmdarima-1.5.2-cp35-cp35m-manylinux1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.5m

pmdarima-1.5.2-cp35-cp35m-macosx_10_13_x86_64.whl (590.4 kB view details)

Uploaded CPython 3.5mmacOS 10.13+ x86-64

File details

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

File metadata

  • Download URL: pmdarima-1.5.2.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.5.7

File hashes

Hashes for pmdarima-1.5.2.tar.gz
Algorithm Hash digest
SHA256 4490928afb862814c38de8fd701c4b4ede92c4347425371a99f1dea473bf2df4
MD5 15523ee44f9f714c5201884d6a55db84
BLAKE2b-256 8a12f0262897416e3661c6873117fd40a31307a751a5bddbe17f228b66947dc6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pmdarima-1.5.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 583.6 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

File hashes

Hashes for pmdarima-1.5.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 168381cdbd0efde24e33b76210e7b912da670977b7a9b7353e225095585e810d
MD5 1f55765527f018eda46629c01860a3c1
BLAKE2b-256 b3946dd46d424af2b167fa7557162f11d98e80bc7ae5def4f7d43de3dbd8656f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pmdarima-1.5.2-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 523.6 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

File hashes

Hashes for pmdarima-1.5.2-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 d20acef0d8788353d6aa4e1fae4a05f41327a3e054b2bf37512ea08029e72303
MD5 472c4ab8516c28c70db12cd2f16ba126
BLAKE2b-256 c18b5e7a0a36eb17803732632b0c66dfa285afd463aef16c8ee55a3daf8d4f18

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pmdarima-1.5.2-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

File hashes

Hashes for pmdarima-1.5.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7cc3c08084e051310dbfc9b01e121391837c67f8b7bbb3ce8d25e2f398c6d68e
MD5 e761b3b711e0cb905da1be362fa59460
BLAKE2b-256 1abdfc357ead270a483fc1ecf8cf4da8f38bca767f14449a7821481a0bdd3366

See more details on using hashes here.

File details

Details for the file pmdarima-1.5.2-cp37-cp37m-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: pmdarima-1.5.2-cp37-cp37m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 596.0 kB
  • Tags: CPython 3.7m, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

File hashes

Hashes for pmdarima-1.5.2-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 2f28a26b31bb4f2593645f83dc4210ef88b0bf72fd189db151227f887c05a7ce
MD5 c945be9e3aa5c757409efb6063737823
BLAKE2b-256 7b14a42e6f1bd8adca72dd42cf58ea8f46fd3826b10669712efda6fe97ae313d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pmdarima-1.5.2-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 583.2 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.6.8

File hashes

Hashes for pmdarima-1.5.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 f7479e1f5b3219d42e2302a92b4817ed98c5c8e21774230ee8db9177ccfe2c35
MD5 dd9ee890319ca37b7f0b6c0c26dce258
BLAKE2b-256 5cec1f3829dd4d60c69402a015b90bfe03c8409623dc8856ceef79197959b294

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pmdarima-1.5.2-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 523.6 kB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.6.8

File hashes

Hashes for pmdarima-1.5.2-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 4390643ce4a5cde36b9b0d8c2e5fd80b396d3e51183404d4a08c1d131e128a89
MD5 a43d6029fa53eea6bd9d95c4b147b183
BLAKE2b-256 8d58271e5f5530a137bc2234247ac5ec8f3acff4c15529f6fc59e4f649d3e068

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pmdarima-1.5.2-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

File hashes

Hashes for pmdarima-1.5.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5dbddcbc6915f9b2a72af07932bf909f0d121af638261f8119e4816c396dfed5
MD5 5545cec08495f7be73f7d7f04b4d69ac
BLAKE2b-256 4a1a32945c19306212fd08547369f40c8965bbc9e18652bb241766dfab398710

See more details on using hashes here.

File details

Details for the file pmdarima-1.5.2-cp36-cp36m-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: pmdarima-1.5.2-cp36-cp36m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 596.0 kB
  • Tags: CPython 3.6m, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.6.9

File hashes

Hashes for pmdarima-1.5.2-cp36-cp36m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 51c9980639bb29b50a0d65d20caf8cda94277b9d2cac67186242e6bd97d78238
MD5 1b91794311eff5f32c8e2157be9981b7
BLAKE2b-256 a826fb51de8846855dc777a1112858873623ed7d6e40bcddc3e0db4da7c6eae8

See more details on using hashes here.

File details

Details for the file pmdarima-1.5.2-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: pmdarima-1.5.2-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 563.4 kB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.5.4

File hashes

Hashes for pmdarima-1.5.2-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 478f1a700739d98b7130b15070cb0062c8a26726731b3e51288b658f1df6d7cd
MD5 196a1d54bf91bd461f646978506ebaff
BLAKE2b-256 cb6f2055ed087ba0cd71c2e316f0089494aefc1573c342c7150be4da1cbf23df

See more details on using hashes here.

File details

Details for the file pmdarima-1.5.2-cp35-cp35m-win32.whl.

File metadata

  • Download URL: pmdarima-1.5.2-cp35-cp35m-win32.whl
  • Upload date:
  • Size: 511.8 kB
  • Tags: CPython 3.5m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.5.4

File hashes

Hashes for pmdarima-1.5.2-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 5ad400624a691d918dc3de5316a6b5edb583932cff8c5537aa77b9bc5a7ccd85
MD5 0f305c964d393b137815ff8317fe250c
BLAKE2b-256 1882c71c6b379f9c3aa0d86d690c4609ef0fef093b6ed449e2a63d78fe3d24c3

See more details on using hashes here.

File details

Details for the file pmdarima-1.5.2-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pmdarima-1.5.2-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

File hashes

Hashes for pmdarima-1.5.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b08cc3f86605620072df86ff039438307fd2eba461bca9a56c18ca9ff3b445db
MD5 bcfd484c180f1f2764f7f0a03d18f3dc
BLAKE2b-256 4b999b7d0ab9337f627f1fd6bce5fa514b17ce54bf3c054c96fd7e4c5a84b858

See more details on using hashes here.

File details

Details for the file pmdarima-1.5.2-cp35-cp35m-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: pmdarima-1.5.2-cp35-cp35m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 590.4 kB
  • Tags: CPython 3.5m, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.5.7

File hashes

Hashes for pmdarima-1.5.2-cp35-cp35m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 34a5df8417c94a4c47ad78a0996411555dea4d539a841a54cbda9f66c04c54be
MD5 43cd3d9126e0007705a0c707fa878eeb
BLAKE2b-256 e2bc9764872fc8f9954e233f824e74043f3fc89668b221b04a12c71b18e9443d

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