Skip to main content

Time series prediction using probabilistic programming

Project description

Chronos

Simple time series prediction model. Implemented using Pyro and greatly inspired by Prophet.

Requirements:

  • python >= 3.7
  • pandas >= 1.1
  • numpy >= 1.19
  • matplotlib >= 3.2
  • torch >= 1.5
  • pyro-ppl >= 1.3

Installation

To install chronos, run the following command from your terminal:

pip install chronos-forecast

Simple Use Case

With the files included, you can load the Divvy bike daily data (the data has been aggregated since the original file is 2GB) as follows:

import pandas as pd
import numpy as np

divvy_data = pd.read_csv('data/divvy_daily_rides.csv')
divvy_data['ds'] = pd.to_datetime(divvy_data['ds'])
print(divvy_data.head())
          ds          y
0 2014-01-01  105421324
1 2014-01-02  123221770
2 2014-01-03    6662107
3 2014-01-04  201035389
4 2014-01-05   35549270

You can call Chronos as follows:

>>> from chronos import Chronos
>>> import chronos_plotting
>>>
>>> my_chronos = Chronos(seasonality_mode="mul", distribution="Gamma")
>>> my_chronos.fit(divvy_data)
Employing Maximum A Posteriori
100.0% - ELBO loss: -1.5903 | Mean Absolute Error: 11152849920.0000

>>> predictions = my_chronos.predict(period=365)
Prediction no: 1000
>>> chronos_plotting.plot_components(predictions, my_chronos)

alt text

Notice we can specify the distribution of the ride shares to be a gamma distribution to ensure they are never negative. Additionally, we made the seasonality multiplicative to make sure that its affect increases as the absolute number of rides increases.

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

chronos-forecast-0.1.0.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

chronos_forecast-0.1.0-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file chronos-forecast-0.1.0.tar.gz.

File metadata

  • Download URL: chronos-forecast-0.1.0.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.6.0.post20210108 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6

File hashes

Hashes for chronos-forecast-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3c6c36c5949cbbd79c1b58f624042ee17531e408271e40bf924b5b9d85acb243
MD5 f4fb8623a65250cacebb6484f70b85a8
BLAKE2b-256 29e1a27437ea7342d67519f5cdd9acc552d9b258faa67c25926eac96faf12922

See more details on using hashes here.

File details

Details for the file chronos_forecast-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: chronos_forecast-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.6.0.post20210108 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6

File hashes

Hashes for chronos_forecast-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66e6a554f5264e0fa744c7af8cc3040bc1141488fdeea00d651a311c9414d1b3
MD5 79b07a483b5e30581cc153b22b01fa23
BLAKE2b-256 c387d8eed64b19caf2a6c60e1178bd45047dbd2465cd07fbda8a154d59681e9c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page