The document provides an overview of time series forecasting and compares two popular tools for forecasting: Facebook Prophet and DeepAR. It discusses what time series are, the challenges of time series forecasting, and how Prophet and DeepAR make forecasting easier. It also presents a use case predicting French energy consumption using both tools and adding weather data as a covariate. Key differences between the two tools are summarized in a table at the end.
7. Main challenges with forecasting
● Managing multiple time series models representing different problems
● Parameters difficult to interpret
● Difficulty to tune time series models (ex: ARIMA*)
● Companies lack experts in time series
* ARIMA: stands for Autoregressive Integrated Moving Average models.
Univariate ARIMA is a forecasting technique that projects the future values of a series based entirely on its own inertia.
7
10. History & implementation
● One tool that can solve most of forecasting problems
● Open source
● First version 0.1 released on February 2017
● Last version 0.5 released on May 2019
● Paper ‘Forecasting at Scale’ published in 2018
● Python & R packages
● Core procedure implemented in Stan *
● pip install fbprophet
● > 9000 Github stars
* Stan: a probabilistic programming language in C++
*https://peerj.com/preprints/3190.pdf
10
11. Suitable for ‘business’ time series
Main Characteristics:
● Changes in trend
● Seasonalities
● Outliers
11
*source: ‘Forecasting at scale’ paper
12. Some insights about the model
&
&
tendance saisonnalité vacances bruit
12
● Additive model
● Regressor like model
● Simple model
● Curve fitting
● Interpretable & intuitive variables
13. Easy API: Scikit-learn like
from fbprophet import Prophet
# model instantiation
m = Prophet()
# model fitting
m.fit(df_data)
# create future dates dataframe
future = m.make_future_dataframe(periods=365)
# predict on future dates
forecast = m.predict(future)
13
15. DeepAR history
● Paper published in April 2017 by Amazon*
● Open sourced within the package gluonTS in June 2019
● pip install gluonts
● Available on Amazon forecast.
*https://arxiv.org/abs/1704.04110
15
16. DeepAR key features
● Train one global model for a set of related time series.
● Native modeling of covariates.
● Predictions as forecast distributions.
*https://arxiv.org/abs/1704.04110
16
17. Under the hood
RNN
Learning of the
probability
distribution
Target values covariates
+ Handling the training of
time series with different
scales
17
18. Very simple API to get started quickly
estimator = DeepAREstimator(freq=data_freq,
prediction_length=7*24,
trainer=Trainer(epochs=30, learning_rate=0.0001))
training_data = ListDataset(
[{"item_id":...,
"start": ...,
"target": ...}],
freq = "H")
estimator.train(training_data)
18
DeepA
R
19. from gluonts.evaluation.backtest import make_evaluation_predictions
test_data = ListDataset(
[{"item_id": ...,
"start": ...,
"target": ...}],
freq = "H")
forecast_it, ts_it = make_evaluation_predictions(test_data, predictor=predictor, num_eval_samples=100)
Very simple API to get started quickly
19
DeepA
R
21. Prediction of energy consumption of French regions
*Source: https://opendata.reseaux-energies.fr/explore/dataset/eco2mix-regional-cons-def/information/?disjunctive.libelle_region&disjunctive.nature
21
*Github: https://github.com/xebia-france/Xebicon19-time-series-made-easy
29. Prediction with weather as covariate (29 epochs, LR=0.0001)
DeepA
R
29(Training on 2017 and 2018 data)
30. Adding weather covariate to Prophet model
from fbprophet import Prophet
# model instantiation
m = Prophet()
# add regressor
m.add_regressor(‘temp’)
# model fitting
m.fit(df_data)
30
e