SlideShare a Scribd company logo
1 of 48
Download to read offline
Time Series made easy
Sameh Ben Fredj & Vincent Villet
November 28th, 2019
@Xebiconfr - #Xebicon19
Who are we ?
Sameh Ben Fredj Vincent Villet
2
Data Scientist Data Scientist
Agenda
● What's time series ?
● Forecasting made easy
○ Facebook Prophet
○ DeepAR
● Use Case
3
What’s time series?
4
A Series of data indexed in time order
5
Nbr of monthly airline passengers
Forecasting
Time Series Everywhere
6
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
Forecasting made easy
8
Facebook Prophet
For business time series
9
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
Suitable for ‘business’ time series
Main Characteristics:
● Changes in trend
● Seasonalities
● Outliers
11
*source: ‘Forecasting at scale’ paper
Some insights about the model
&
&
tendance saisonnalité vacances bruit
12
● Additive model
● Regressor like model
● Simple model
● Curve fitting
● Interpretable & intuitive variables
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
DeepAR
Time Series forecasting at scale
14
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
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
Under the hood
RNN
Learning of the
probability
distribution
Target values covariates
+ Handling the training of
time series with different
scales
17
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
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
Use Case
French energy forecasting
20
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
Prediction for Île-de-France
(29 epochs, LR=0.0001)
DeepA
R
22(Training on 2017 and 2018 data)
Prediction for Île-de-France trained with all
regions (29 epochs, LR=0.0001)
DeepA
R
23(Training on 2017 and 2018 data)
Prediction for Ile de France
24(Training on 2017 and 2018 data)
25
SARIMA: Seasonal Autoregressive Integrated Moving Average
*Train on 2 months and prediction for 2 weeks*
Prophet vs SARIMA
Prophet vs SARIMA
26
*Train on 1 month and prediction for 3 days*
Adding weather data as covariate
27
estimator = DeepAREstimator(freq=data_freq,
prediction_length=7*24,
trainer=Trainer(epochs=30, learning_rate = 0.0001),
use_feat_dynamic_real=True)
training_data = ListDataset(
[{"item_id": ...,
"start": ...,
"target": ...,
"feat_dynamic_real": ...}],
freq = "H")
estimator.train(training_data)
Adding weather data as covariate
28
DeepA
R
Prediction with weather as covariate (29 epochs, LR=0.0001)
DeepA
R
29(Training on 2017 and 2018 data)
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
Prediction with weather as covariate
31(Training on 2017 and 2018 data)
Conclusion
32
Comparative table
Prophet DeepAR
Installation - +
Documentation + -
Multiple time series - +
Complex seasonality + +
Probability distributions + +
Interpretability + -
Result stability + -
33
Thank you !
@Xebiconfr - #Xebicon19
Q&A
Feedbacks
34
Github: https://github.com/xebia-france/Xebicon19-time-series-
made-easy
Appendices
35
Prediction stability study
36
Example with a model trained on 20 epochs:
Beware: training results can be unstable
37
Example with 100 epochs:
DeepA
R
(Training on 2017 and 2018 data)
Beware: training results can be unstable
38
Example with 100 epochs:
DeepA
R
(Training on 2017 and 2018 data)
Beware: training results can be unstable
39
Example with 100 epochs:
DeepA
R
(Training on 2017 and 2018 data)
Beware: training results can be unstable
40
Example with 100 epochs:
DeepA
R
(Training on 2017 and 2018 data)
Beware: training results can be unstable
41
Example with 100 epochs:Example with 100 epochs:
DeepA
R
(Training on 2017 and 2018 data)
Beware: training results can be unstable
42
Example with 100 epochs:Example with 100 epochs:
DeepA
R
(Training on 2017 and 2018 data)
Beware: training results can be unstable
43
Example with 100 epochs:Example with 100 epochs:
DeepA
R
(Training on 2017 and 2018 data)
Deepar stability analysis
44(Training on 2017 and 2018 data)
Others Appendices
45
46
SARIMA: Seasonal Autoregressive Integrated Moving Average
Train on 2 months and prediction for 2 weeks
Prophet vs SARIMA
Prophet vs SARIMA
47
Train on 1 months and prediction for 3 days
Easy API
● 1 Class to create a forcaster object: Prophet()
● Business params : growth, yearly_seasonality, holidays, etc.
● 4 main sub-packages:
○ fbprophet.diagnostics: evaluating model
○ fbprophet.make_holidays: adding holidays
○ fbprophet.models: importing prophet_stan_model
○ fbprophet.plot: plotting graphs
48

More Related Content

What's hot

06 - HAMS implementation
06 - HAMS implementation06 - HAMS implementation
06 - HAMS implementationHAMSproject
 
MediaEval 2017 - Interestingness Task: The IITB Predicting Media Interestingn...
MediaEval 2017 - Interestingness Task: The IITB Predicting Media Interestingn...MediaEval 2017 - Interestingness Task: The IITB Predicting Media Interestingn...
MediaEval 2017 - Interestingness Task: The IITB Predicting Media Interestingn...multimediaeval
 
sin cos & tan (Plot using MATLAB)
sin cos  & tan (Plot using MATLAB)sin cos  & tan (Plot using MATLAB)
sin cos & tan (Plot using MATLAB)shivam choubey
 
Presentation on Degree of field extension
Presentation on  Degree of field extensionPresentation on  Degree of field extension
Presentation on Degree of field extensionRajKoirala2
 
7 2 Graphing Simple Quadratic Functions
7 2 Graphing Simple Quadratic Functions7 2 Graphing Simple Quadratic Functions
7 2 Graphing Simple Quadratic FunctionsBitsy Griffin
 

What's hot (6)

06 - HAMS implementation
06 - HAMS implementation06 - HAMS implementation
06 - HAMS implementation
 
Mcs 2014
Mcs  2014Mcs  2014
Mcs 2014
 
MediaEval 2017 - Interestingness Task: The IITB Predicting Media Interestingn...
MediaEval 2017 - Interestingness Task: The IITB Predicting Media Interestingn...MediaEval 2017 - Interestingness Task: The IITB Predicting Media Interestingn...
MediaEval 2017 - Interestingness Task: The IITB Predicting Media Interestingn...
 
sin cos & tan (Plot using MATLAB)
sin cos  & tan (Plot using MATLAB)sin cos  & tan (Plot using MATLAB)
sin cos & tan (Plot using MATLAB)
 
Presentation on Degree of field extension
Presentation on  Degree of field extensionPresentation on  Degree of field extension
Presentation on Degree of field extension
 
7 2 Graphing Simple Quadratic Functions
7 2 Graphing Simple Quadratic Functions7 2 Graphing Simple Quadratic Functions
7 2 Graphing Simple Quadratic Functions
 

Similar to Time Series Made Easy

Start machine learning in 5 simple steps
Start machine learning in 5 simple stepsStart machine learning in 5 simple steps
Start machine learning in 5 simple stepsRenjith M P
 
Creating a custom ML model for your application - DevFest Lima 2019
Creating a custom ML model for your application - DevFest Lima 2019Creating a custom ML model for your application - DevFest Lima 2019
Creating a custom ML model for your application - DevFest Lima 2019Isabel Palomar
 
Web Traffic Time Series Forecasting
Web Traffic  Time Series ForecastingWeb Traffic  Time Series Forecasting
Web Traffic Time Series ForecastingBillTubbs
 
Nathaniel Cook - Forecasting Time Series Data at scale with the TICK stack
Nathaniel Cook - Forecasting Time Series Data at scale with the TICK stackNathaniel Cook - Forecasting Time Series Data at scale with the TICK stack
Nathaniel Cook - Forecasting Time Series Data at scale with the TICK stackPyData
 
Graph Gurus 15: Introducing TigerGraph 2.4
Graph Gurus 15: Introducing TigerGraph 2.4 Graph Gurus 15: Introducing TigerGraph 2.4
Graph Gurus 15: Introducing TigerGraph 2.4 TigerGraph
 
Creating a custom Machine Learning Model for your applications - Java Dev Day...
Creating a custom Machine Learning Model for your applications - Java Dev Day...Creating a custom Machine Learning Model for your applications - Java Dev Day...
Creating a custom Machine Learning Model for your applications - Java Dev Day...Isabel Palomar
 
Inteligencia artificial para android como empezar
Inteligencia artificial para android como empezarInteligencia artificial para android como empezar
Inteligencia artificial para android como empezarIsabel Palomar
 
DataMind: An e-learning platform for Data Analysis based on R. RBelgium meetu...
DataMind: An e-learning platform for Data Analysis based on R. RBelgium meetu...DataMind: An e-learning platform for Data Analysis based on R. RBelgium meetu...
DataMind: An e-learning platform for Data Analysis based on R. RBelgium meetu...DataMind-slides
 
Ml programming with python
Ml programming with pythonMl programming with python
Ml programming with pythonKumud Arora
 
Differences of Deep Learning Frameworks
Differences of Deep Learning FrameworksDifferences of Deep Learning Frameworks
Differences of Deep Learning FrameworksSeiya Tokui
 
Building a custom machine learning model on android
Building a custom machine learning model on androidBuilding a custom machine learning model on android
Building a custom machine learning model on androidIsabel Palomar
 
Modeling and Performance Analysis of Scrumban with Test-Driven Development us...
Modeling and Performance Analysis of Scrumban with Test-Driven Development us...Modeling and Performance Analysis of Scrumban with Test-Driven Development us...
Modeling and Performance Analysis of Scrumban with Test-Driven Development us...Fernando Sambinelli, MSc
 
Creating a Custom ML Model for your Application - Kotlin/Everywhere
Creating a Custom ML Model for your Application - Kotlin/EverywhereCreating a Custom ML Model for your Application - Kotlin/Everywhere
Creating a Custom ML Model for your Application - Kotlin/EverywhereIsabel Palomar
 
ML Platform Q1 Meetup: Airbnb's End-to-End Machine Learning Infrastructure
ML Platform Q1 Meetup: Airbnb's End-to-End Machine Learning InfrastructureML Platform Q1 Meetup: Airbnb's End-to-End Machine Learning Infrastructure
ML Platform Q1 Meetup: Airbnb's End-to-End Machine Learning InfrastructureFei Chen
 
Deduplicating and analysing time-series data with Apache Beam and QuestDB
Deduplicating and analysing time-series data with Apache Beam and QuestDBDeduplicating and analysing time-series data with Apache Beam and QuestDB
Deduplicating and analysing time-series data with Apache Beam and QuestDBjavier ramirez
 
Deployment Design Patterns - Deploying Machine Learning and Deep Learning Mod...
Deployment Design Patterns - Deploying Machine Learning and Deep Learning Mod...Deployment Design Patterns - Deploying Machine Learning and Deep Learning Mod...
Deployment Design Patterns - Deploying Machine Learning and Deep Learning Mod...All Things Open
 
AllThingsOpen 2018 - Deployment Design Patterns (Dan Zaratsian)
AllThingsOpen 2018 - Deployment Design Patterns (Dan Zaratsian)AllThingsOpen 2018 - Deployment Design Patterns (Dan Zaratsian)
AllThingsOpen 2018 - Deployment Design Patterns (Dan Zaratsian)dtz001
 
OpenPOWER Webinar from University of Delaware - Title :OpenMP (offloading) o...
OpenPOWER Webinar from University of Delaware  - Title :OpenMP (offloading) o...OpenPOWER Webinar from University of Delaware  - Title :OpenMP (offloading) o...
OpenPOWER Webinar from University of Delaware - Title :OpenMP (offloading) o...Ganesan Narayanasamy
 
High ROI Testing in Angular.pptx
High ROI Testing in Angular.pptxHigh ROI Testing in Angular.pptx
High ROI Testing in Angular.pptxChristian Lüdemann
 
Demand time series analysis and forecasting
Demand time series analysis and forecastingDemand time series analysis and forecasting
Demand time series analysis and forecastingM Baddar
 

Similar to Time Series Made Easy (20)

Start machine learning in 5 simple steps
Start machine learning in 5 simple stepsStart machine learning in 5 simple steps
Start machine learning in 5 simple steps
 
Creating a custom ML model for your application - DevFest Lima 2019
Creating a custom ML model for your application - DevFest Lima 2019Creating a custom ML model for your application - DevFest Lima 2019
Creating a custom ML model for your application - DevFest Lima 2019
 
Web Traffic Time Series Forecasting
Web Traffic  Time Series ForecastingWeb Traffic  Time Series Forecasting
Web Traffic Time Series Forecasting
 
Nathaniel Cook - Forecasting Time Series Data at scale with the TICK stack
Nathaniel Cook - Forecasting Time Series Data at scale with the TICK stackNathaniel Cook - Forecasting Time Series Data at scale with the TICK stack
Nathaniel Cook - Forecasting Time Series Data at scale with the TICK stack
 
Graph Gurus 15: Introducing TigerGraph 2.4
Graph Gurus 15: Introducing TigerGraph 2.4 Graph Gurus 15: Introducing TigerGraph 2.4
Graph Gurus 15: Introducing TigerGraph 2.4
 
Creating a custom Machine Learning Model for your applications - Java Dev Day...
Creating a custom Machine Learning Model for your applications - Java Dev Day...Creating a custom Machine Learning Model for your applications - Java Dev Day...
Creating a custom Machine Learning Model for your applications - Java Dev Day...
 
Inteligencia artificial para android como empezar
Inteligencia artificial para android como empezarInteligencia artificial para android como empezar
Inteligencia artificial para android como empezar
 
DataMind: An e-learning platform for Data Analysis based on R. RBelgium meetu...
DataMind: An e-learning platform for Data Analysis based on R. RBelgium meetu...DataMind: An e-learning platform for Data Analysis based on R. RBelgium meetu...
DataMind: An e-learning platform for Data Analysis based on R. RBelgium meetu...
 
Ml programming with python
Ml programming with pythonMl programming with python
Ml programming with python
 
Differences of Deep Learning Frameworks
Differences of Deep Learning FrameworksDifferences of Deep Learning Frameworks
Differences of Deep Learning Frameworks
 
Building a custom machine learning model on android
Building a custom machine learning model on androidBuilding a custom machine learning model on android
Building a custom machine learning model on android
 
Modeling and Performance Analysis of Scrumban with Test-Driven Development us...
Modeling and Performance Analysis of Scrumban with Test-Driven Development us...Modeling and Performance Analysis of Scrumban with Test-Driven Development us...
Modeling and Performance Analysis of Scrumban with Test-Driven Development us...
 
Creating a Custom ML Model for your Application - Kotlin/Everywhere
Creating a Custom ML Model for your Application - Kotlin/EverywhereCreating a Custom ML Model for your Application - Kotlin/Everywhere
Creating a Custom ML Model for your Application - Kotlin/Everywhere
 
ML Platform Q1 Meetup: Airbnb's End-to-End Machine Learning Infrastructure
ML Platform Q1 Meetup: Airbnb's End-to-End Machine Learning InfrastructureML Platform Q1 Meetup: Airbnb's End-to-End Machine Learning Infrastructure
ML Platform Q1 Meetup: Airbnb's End-to-End Machine Learning Infrastructure
 
Deduplicating and analysing time-series data with Apache Beam and QuestDB
Deduplicating and analysing time-series data with Apache Beam and QuestDBDeduplicating and analysing time-series data with Apache Beam and QuestDB
Deduplicating and analysing time-series data with Apache Beam and QuestDB
 
Deployment Design Patterns - Deploying Machine Learning and Deep Learning Mod...
Deployment Design Patterns - Deploying Machine Learning and Deep Learning Mod...Deployment Design Patterns - Deploying Machine Learning and Deep Learning Mod...
Deployment Design Patterns - Deploying Machine Learning and Deep Learning Mod...
 
AllThingsOpen 2018 - Deployment Design Patterns (Dan Zaratsian)
AllThingsOpen 2018 - Deployment Design Patterns (Dan Zaratsian)AllThingsOpen 2018 - Deployment Design Patterns (Dan Zaratsian)
AllThingsOpen 2018 - Deployment Design Patterns (Dan Zaratsian)
 
OpenPOWER Webinar from University of Delaware - Title :OpenMP (offloading) o...
OpenPOWER Webinar from University of Delaware  - Title :OpenMP (offloading) o...OpenPOWER Webinar from University of Delaware  - Title :OpenMP (offloading) o...
OpenPOWER Webinar from University of Delaware - Title :OpenMP (offloading) o...
 
High ROI Testing in Angular.pptx
High ROI Testing in Angular.pptxHigh ROI Testing in Angular.pptx
High ROI Testing in Angular.pptx
 
Demand time series analysis and forecasting
Demand time series analysis and forecastingDemand time series analysis and forecasting
Demand time series analysis and forecasting
 

More from Sameh BEN FREDJ

Blockchain & IoT: The new contract of Trust
Blockchain & IoT: The new contract of TrustBlockchain & IoT: The new contract of Trust
Blockchain & IoT: The new contract of TrustSameh BEN FREDJ
 
A connected bar with Greengrass & some Deep Learning
A connected bar with Greengrass & some Deep LearningA connected bar with Greengrass & some Deep Learning
A connected bar with Greengrass & some Deep LearningSameh BEN FREDJ
 
On a connecté le studio !
On a connecté le studio !On a connecté le studio !
On a connecté le studio !Sameh BEN FREDJ
 
Living in a connected world_Devoxx2015_Duchess France
Living in a connected world_Devoxx2015_Duchess FranceLiving in a connected world_Devoxx2015_Duchess France
Living in a connected world_Devoxx2015_Duchess FranceSameh BEN FREDJ
 
Introduction à l'IoT: du capteur à la donnée_Presentation Mix-IT2015
Introduction à l'IoT: du capteur à la donnée_Presentation Mix-IT2015Introduction à l'IoT: du capteur à la donnée_Presentation Mix-IT2015
Introduction à l'IoT: du capteur à la donnée_Presentation Mix-IT2015Sameh BEN FREDJ
 

More from Sameh BEN FREDJ (6)

IoT: From Edge to Cloud
IoT: From Edge to CloudIoT: From Edge to Cloud
IoT: From Edge to Cloud
 
Blockchain & IoT: The new contract of Trust
Blockchain & IoT: The new contract of TrustBlockchain & IoT: The new contract of Trust
Blockchain & IoT: The new contract of Trust
 
A connected bar with Greengrass & some Deep Learning
A connected bar with Greengrass & some Deep LearningA connected bar with Greengrass & some Deep Learning
A connected bar with Greengrass & some Deep Learning
 
On a connecté le studio !
On a connecté le studio !On a connecté le studio !
On a connecté le studio !
 
Living in a connected world_Devoxx2015_Duchess France
Living in a connected world_Devoxx2015_Duchess FranceLiving in a connected world_Devoxx2015_Duchess France
Living in a connected world_Devoxx2015_Duchess France
 
Introduction à l'IoT: du capteur à la donnée_Presentation Mix-IT2015
Introduction à l'IoT: du capteur à la donnée_Presentation Mix-IT2015Introduction à l'IoT: du capteur à la donnée_Presentation Mix-IT2015
Introduction à l'IoT: du capteur à la donnée_Presentation Mix-IT2015
 

Recently uploaded

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Recently uploaded (20)

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Time Series Made Easy

  • 1. Time Series made easy Sameh Ben Fredj & Vincent Villet November 28th, 2019 @Xebiconfr - #Xebicon19
  • 2. Who are we ? Sameh Ben Fredj Vincent Villet 2 Data Scientist Data Scientist
  • 3. Agenda ● What's time series ? ● Forecasting made easy ○ Facebook Prophet ○ DeepAR ● Use Case 3
  • 5. A Series of data indexed in time order 5 Nbr of monthly airline passengers Forecasting
  • 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
  • 20. Use Case French energy forecasting 20
  • 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
  • 22. Prediction for Île-de-France (29 epochs, LR=0.0001) DeepA R 22(Training on 2017 and 2018 data)
  • 23. Prediction for Île-de-France trained with all regions (29 epochs, LR=0.0001) DeepA R 23(Training on 2017 and 2018 data)
  • 24. Prediction for Ile de France 24(Training on 2017 and 2018 data)
  • 25. 25 SARIMA: Seasonal Autoregressive Integrated Moving Average *Train on 2 months and prediction for 2 weeks* Prophet vs SARIMA
  • 26. Prophet vs SARIMA 26 *Train on 1 month and prediction for 3 days*
  • 27. Adding weather data as covariate 27
  • 28. estimator = DeepAREstimator(freq=data_freq, prediction_length=7*24, trainer=Trainer(epochs=30, learning_rate = 0.0001), use_feat_dynamic_real=True) training_data = ListDataset( [{"item_id": ..., "start": ..., "target": ..., "feat_dynamic_real": ...}], freq = "H") estimator.train(training_data) Adding weather data as covariate 28 DeepA R
  • 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
  • 31. Prediction with weather as covariate 31(Training on 2017 and 2018 data)
  • 33. Comparative table Prophet DeepAR Installation - + Documentation + - Multiple time series - + Complex seasonality + + Probability distributions + + Interpretability + - Result stability + - 33
  • 34. Thank you ! @Xebiconfr - #Xebicon19 Q&A Feedbacks 34 Github: https://github.com/xebia-france/Xebicon19-time-series- made-easy
  • 36. Prediction stability study 36 Example with a model trained on 20 epochs:
  • 37. Beware: training results can be unstable 37 Example with 100 epochs: DeepA R (Training on 2017 and 2018 data)
  • 38. Beware: training results can be unstable 38 Example with 100 epochs: DeepA R (Training on 2017 and 2018 data)
  • 39. Beware: training results can be unstable 39 Example with 100 epochs: DeepA R (Training on 2017 and 2018 data)
  • 40. Beware: training results can be unstable 40 Example with 100 epochs: DeepA R (Training on 2017 and 2018 data)
  • 41. Beware: training results can be unstable 41 Example with 100 epochs:Example with 100 epochs: DeepA R (Training on 2017 and 2018 data)
  • 42. Beware: training results can be unstable 42 Example with 100 epochs:Example with 100 epochs: DeepA R (Training on 2017 and 2018 data)
  • 43. Beware: training results can be unstable 43 Example with 100 epochs:Example with 100 epochs: DeepA R (Training on 2017 and 2018 data)
  • 44. Deepar stability analysis 44(Training on 2017 and 2018 data)
  • 46. 46 SARIMA: Seasonal Autoregressive Integrated Moving Average Train on 2 months and prediction for 2 weeks Prophet vs SARIMA
  • 47. Prophet vs SARIMA 47 Train on 1 months and prediction for 3 days
  • 48. Easy API ● 1 Class to create a forcaster object: Prophet() ● Business params : growth, yearly_seasonality, holidays, etc. ● 4 main sub-packages: ○ fbprophet.diagnostics: evaluating model ○ fbprophet.make_holidays: adding holidays ○ fbprophet.models: importing prophet_stan_model ○ fbprophet.plot: plotting graphs 48