Python-bloggers

(News from) forecasting in Python with ahead (progress bars and plots)

This article was first published on T. Moudiki's Webpage - Python , and kindly contributed to python-bloggers. (You can report issue about the content on this page here)
Want to share your content on python-bloggers? click here.

A new Python version of ahead, v0.9.0 is now available on GitHub and PyPI.

ahead is a Python and R package for univariate and multivariate time series forecasting, with uncertainty
quantification
(in particular, simulation-based uncertainty quantification).

Here are the new features in v0.9.0:

Since this implementation is based on the R version, it could take some time to import R packages when using Python’s ahead for the first time. There’s something new regarding this situation (well… ha ha): R packages are now installed on the fly. Meaning: only when they’re required.

Example 1

import numpy as np
import pandas as pd
from time import time

url = "https://raw.githubusercontent.com/thierrymoudiki/mts-data/master/heater-ice-cream/ice_cream_vs_heater.csv"


df = pd.read_csv(url)

df.set_index('Month', inplace=True) # only for ice_cream_vs_heater
df.index.rename('date') # only for ice_cream_vs_heater

df = df.pct_change().dropna()
regr1 = Ridge2Regressor(h = 10, date_formatting = "original",
                     type_pi="rvinecopula",
                     margins="empirical",
                     B=50, seed=1)

regr1.forecast(df) 

regr1.plot(0) # dates are missing, + want to use series names
regr1.plot(1)

Example 2

regr2 = Ridge2Regressor(h = 10, date_formatting = "original",
                     type_pi="movingblockbootstrap",
                     B=50, seed=1)

regr2.forecast(df) # a progress bar is displayed

regr2.plot(0) # dates are missing, + want to use series names
regr2.plot(1)

To leave a comment for the author, please follow the link and comment on their blog: T. Moudiki's Webpage - Python .

Want to share your content on python-bloggers? click here.
Exit mobile version