(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.
Want to share your content on python-bloggers? click here.
A new Python version of aheadahead
,
v0.9.0
v0.9.0
is now available on GitHub and PyPI.ahead
ahead
is a Python and R package for univariate and multivariate time series forecasting, with uncertaintyquantification (in particular, simulation-based uncertainty quantification).
Here are the new features in
v0.9.0
v0.9.0
:progress bars for possibly long calculations: the bootstrap (independent, circular block, moving block)
plot for
Ridge2RegressorRidge2Regressor
(a work in progress, still needs to use series names, and display dates correctly, for all classes, not justRidge2RegressorRidge2Regressor
)
Since this implementation is based on the R version, it could take some time to import R packages when using Python’s
ahead
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()
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()
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)
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)
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)
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)
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.