Skip to content

Commit 0a30b61

Browse files
authored
[FIX] Add missing tutorial for AutoARIMAProphet adapter (#1117)
1 parent 2e4e9ff commit 0a30b61

6 files changed

Lines changed: 146 additions & 1508 deletions

File tree

docs/mintlify/docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"pages": [
6565
"docs/experiments/amazonstatsforecast.html",
6666
"docs/experiments/autoarima_vs_prophet.html",
67+
"docs/experiments/autoarimaprophet_adapter.html",
6768
"docs/experiments/ets_ray_m5.html",
6869
"docs/experiments/prophet_spark_m5.html"
6970
]
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# AutoARIMAProphet Adapter\n",
8+
"> AutoArima is faster and more accurate than FB-Prophet in most cases. Replace it with two lines of code."
9+
],
10+
"id": "a1b2c3d4"
11+
},
12+
{
13+
"cell_type": "markdown",
14+
"metadata": {},
15+
"source": [
16+
"We benchmarked on more than 100K series and show that you can improve _MAPE_ and _sMAPE_ forecast accuracy by _17%_ and _15%_ with _37x_ less computational time.\n",
17+
"\n",
18+
"Now you can replace Prophet with two lines of code and verify it for yourself.\n",
19+
"\n",
20+
"### Install StatsForecast\n",
21+
"```bash\n",
22+
"pip install statsforecast\n",
23+
"```\n",
24+
"\n",
25+
"### Replace FB-Prophet to make your forecast a lot faster\n",
26+
"![comparison-code](../../imgs/autoarimaprophet/comparison-code.png)\n",
27+
"\n",
28+
"We respected the original Prophet syntax so your pipeline won't get affected."
29+
],
30+
"id": "b2c3d4e5"
31+
},
32+
{
33+
"cell_type": "markdown",
34+
"metadata": {},
35+
"source": [
36+
"## Results on M3, M4, Tourism and Peyton Manning\n",
37+
"\n",
38+
"![comparison](../../imgs/autoarimaprophet/comparison.png)"
39+
],
40+
"id": "c3d4e5f6"
41+
},
42+
{
43+
"cell_type": "markdown",
44+
"metadata": {},
45+
"source": [
46+
"## Background\n",
47+
"\n",
48+
"[FB-Prophet](https://github.com/facebook/prophet) is one of the world's most used time series forecasting models. Its GitHub repository has more than 14 thousand stars, and more than a hundred repositories depend on it. However, in many scenarios, [FB-Prophet does not offer good performance in terms of time and accuracy.](https://analyticsindiamag.com/why-are-people-bashing-facebook-prophet/) This lacking performance suggests that the FB-Prophet's success can be explained mainly by its usability. For example, [adding exogenous and calendar variables is almost trivial.](https://facebook.github.io/prophet/docs/seasonality,_holiday_effects,_and_regressors.html)\n",
49+
"\n",
50+
"To contribute to the forecasting community, we created a _FB-Prophet API adapter_ that lets you use Prophet's useful methods without accuracy and computational downsides. Just import this AutoARIMAProphet adapter and replace the Prophet class to start using AutoARIMA in any of your existing pipelines."
51+
],
52+
"id": "d4e5f6a7"
53+
},
54+
{
55+
"cell_type": "markdown",
56+
"metadata": {},
57+
"source": [
58+
"## Empirical validation\n",
59+
"\n",
60+
"To validate the AutoARIMAProphet adapter, we designed a pipeline considering the M3, M4, and Tourism datasets (standard benchmarks in the forecasting practice) and the Peyton Manning data set originally used by FB. The pipeline automatically selects ARIMA's parameters with the AIC criterion and selects Prophet's parameters with time-series cross-validation."
61+
],
62+
"id": "e5f6a7b8"
63+
},
64+
{
65+
"cell_type": "markdown",
66+
"metadata": {},
67+
"source": [
68+
"## Results\n",
69+
"\n",
70+
"The following table shows the MAPE, sMAPE and Time (in minutes) AutoARIMA improvements on Prophet for each dataset.\n",
71+
"\n",
72+
"![results-table](../../imgs/autoarimaprophet/results-table.png)"
73+
],
74+
"id": "f6a7b8c9"
75+
},
76+
{
77+
"cell_type": "markdown",
78+
"metadata": {},
79+
"source": [
80+
"## Reproducibility\n",
81+
"\n",
82+
"1. Create a conda environment `arima_prophet` using the `environment.yml` file.\n",
83+
" ```shell\n",
84+
" conda env create -f environment.yml\n",
85+
" ```\n",
86+
"\n",
87+
"2. Activate the conda environment using\n",
88+
" ```shell\n",
89+
" conda activate arima_prophet\n",
90+
" ```\n",
91+
"\n",
92+
"3. Run the experiments for each dataset and each model using\n",
93+
" ```shell\n",
94+
" python -m src.experiment --dataset [dataset] --group [group] --model_name [model_name]\n",
95+
" ```\n",
96+
" For `M4`, the groups are `Yearly`, `Monthly`, `Quarterly`, `Weekly`, `Daily`, and `Hourly`. For `M3`, the groups are `Yearly`, `Monthly`, `Quarterly`, and `Other`. For `Tourism`, the groups are `Yearly`, `Monthly`, and `Quarterly`. Finally, for `PeytonManning` the group is `Daily`.\n",
97+
"\n",
98+
"4. Evaluate the results using\n",
99+
" ```shell\n",
100+
" python -m src.evaluation\n",
101+
" ```"
102+
],
103+
"id": "a7b8c9d0"
104+
},
105+
{
106+
"cell_type": "markdown",
107+
"metadata": {},
108+
"source": [
109+
"## Conclusion\n",
110+
"\n",
111+
"* Be mindful on what you read on Towards Data Science.\n",
112+
"* Always use strong baselines when forecasting.\n",
113+
"* Quick and easy results are sometimes [misleading](https://en.wikipedia.org/wiki/Streetlight_effect).\n",
114+
"* Simpler models are sometimes [better](https://en.wikipedia.org/wiki/Occam%27s_razor).\n",
115+
"* **Facebook's Prophet might be many things, but it's definitely not a model for forecasting time series at scale.**"
116+
],
117+
"id": "b8c9d0e1"
118+
},
119+
{
120+
"cell_type": "markdown",
121+
"metadata": {},
122+
"source": [
123+
"## Misc.\n",
124+
"\n",
125+
"* [`StatsForecast`](https://github.com/nixtla/statsforecast) also includes a variety of lightning fast baseline models.\n",
126+
"* If you really need to do forecast at scale, [here](https://github.com/nixtla/statsforecast/tree/main/experiments/ray) we show how to forecast 1 million time series under 30 minutes using [Ray](https://github.com/ray-project/ray).\n",
127+
"* If you are interested in SOTA Deep Learning models, check [`NeuralForecast`](https://github.com/nixtla/neuralforecast)."
128+
],
129+
"id": "c9d0e1f2"
130+
}
131+
],
132+
"metadata": {
133+
"kernelspec": {
134+
"display_name": "Python 3 (ipykernel)",
135+
"language": "python",
136+
"name": "python3"
137+
},
138+
"language_info": {
139+
"name": "python",
140+
"version": "3.10.0"
141+
}
142+
},
143+
"nbformat": 4,
144+
"nbformat_minor": 5
145+
}

nbs/docs/experiments/AutoArima_vs_Prophet.ipynb

Lines changed: 0 additions & 1508 deletions
This file was deleted.
614 KB
Loading
2 MB
Loading
1.16 MB
Loading

0 commit comments

Comments
 (0)