Skip to content

Commit

Permalink
Doc: Improove docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mergenthaler committed Nov 29, 2022
1 parent 1184df3 commit 1e2bd49
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 56 deletions.
7 changes: 5 additions & 2 deletions nbs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ format:
toc: true

website:
twitter-card: true
open-graph: true
twitter-card:
image: "https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg"
site: "@Nixtlainc"
open-graph:
image: "https://github.com/Nixtla/styles/blob/2abf51612584169874c90cd7c4d347e3917eaf73/images/Banner%20Github.png"
google-analytics: "G-NXJNCVR18L"
repo-actions: [issue]
favicon: favicon_png.png
Expand Down
1 change: 1 addition & 0 deletions nbs/custom.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
website:
logo: https://github.com/Nixtla/styles/blob/b9ea432cfa2dae20fc84d8634cae6db902f9ca3f/images/Nixtla_Blanco.png
reader-mode: false
navbar:
collapse-below: lg
Expand Down
198 changes: 144 additions & 54 deletions nbs/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
"ename": "",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[1;31mJupyter cannot be started. Error attempting to locate Jupyter: Running cells with 'Python 3.9.6 64-bit' requires notebook and jupyter package.\n",
"\u001b[1;31mRun the following command to install 'jupyter and notebook' into the Python environment. \n",
"\u001b[1;31mCommand: 'python -m pip install jupyter notebook -U\n",
"\u001b[1;31mor\n",
"\u001b[1;31mconda install jupyter notebook -U'\n",
"\u001b[1;31mClick <a href='https://aka.ms/installJupyterForVSCode'>here</a> for more info."
]
}
],
Expand Down Expand Up @@ -53,32 +58,57 @@
"source": [
"## Installation\n",
"\n",
"You can install the *released version* of `StatsForecast` from the [Python package index](https://pypi.org) with:\n",
"You can install `StatsForecast` with:\n",
"\n",
"```python\n",
"pip install statsforecast\n",
"```\n",
"We are constantly updating StatsForecast, so we suggest fixing the version to avoid issues. `pip install statsforecast==\"1.0.0\"`\n",
"\n",
"\n",
"We recommend installing your libraries inside a python virtual or conda environment. To install the latest *released version* of `StatsForecast` from [conda](https://anaconda.org) run this command:\n",
"or \n",
"\n",
"```python\n",
"conda install -c conda-forge statsforecast\n",
"```\n",
"\n"
"``` \n",
"\n",
"\n",
"Vist our [Installation Guide](https://nixtla.github.io/statsforecast/examples/installation.html) for further instructions.\n"
]
},
{
"cell_type": "markdown",
"id": "90f422b7",
"metadata": {},
"source": [
"## Get Started\n",
"## Quick Start\n",
"\n",
"**Minimal Example**\n",
"\n",
"```python\n",
"from statsforecast import StatsForecast\n",
"from statsforecast.models import AutoARIMA\n",
"\n",
"sf = StatsForecast(\n",
" models = [AutoARIMA(season_length = 12)],\n",
" freq = 'M'\n",
")\n",
"\n",
"sf.fit(df)\n",
"sf.predict(h=12, level=[95])\n",
"```\n",
"\n",
"To get started with a minimal example, follow this [guide](./examples/Getting_Started_short.ipynb)\n",
"**Get Started with this [quick guide](./examples/Getting_Started_short.ipynb).**\n",
"\n",
"Or follow this [stept by step guide ](./examples/Getting_Started_complete.ipynb) to train, evaluate and select multiple models on many time series. "
"**Follow this [end-to-end walkthrough](./examples/Getting_Started_complete.ipynb) for best practices.**"
]
},
{
"cell_type": "markdown",
"id": "2fec4ce5",
"metadata": {},
"source": [
"## Why? \n",
"\n",
"Current Python alternatives for statistical models are slow, inaccurate and don't scale well. So we created a library that can be used to forecast in production environments or as benchmarks. `StatsForecast` includes an extensive battery of models that can efficiently fit millions of time series."
]
},
{
Expand All @@ -88,9 +118,10 @@
"source": [
"## Features\n",
"\n",
"* Fastest and most accurate implementations of `AutoARIMA`, `ETS`, `AutoCES`, and `MSTL` in Python. \n",
"* Fastest and most accurate implementations of `AutoARIMA`, `AutoETS`, `AutoCES`, `MSTL` and `Theta` in Python. \n",
"* Out-of-the-box compatibility with Spark, Dask, and Ray.\n",
"* Probabilistic Forecasting and Confidence Intervals.\n",
"* Support for exogenous Variables and static covariates.\n",
"* Anomaly Detection.\n",
"* Familiar sklearn syntax: `.fit` and `.predict`. \n",
"* Intermittent demand forecasting with `CrostonClassic`, `CrostonSBA`, `CrostonOptimized`, `ADIDA`, and `IMAPA`.\n",
Expand All @@ -106,64 +137,125 @@
"## Highlights\n",
"\n",
"* Inclusion of `exogenous variables` and `prediction intervals` for ARIMA.\n",
"* 20x faster than `pmdarima`.\n",
"* 20x [faster](./experiments/arima/) than `pmdarima`.\n",
"* 1.5x faster than `R`.\n",
"* 500x faster than `Prophet`. \n",
"* 4x faster than `statsmodels`.\n",
"* 4x [faster](./experiments/ets/) than `statsmodels`.\n",
"* Compiled to high performance machine code through [`numba`](https://numba.pydata.org/).\n",
"* 1,000,000 series in [30 min](https://github.com/Nixtla/statsforecast/tree/main/experiments/ray) with [ray](https://github.com/ray-project/ray).\n",
"* Replace FB-Prophet in two lines of code and gain speed and accuracy. Check the experiments [here](https://github.com/Nixtla/statsforecast/tree/main/experiments/arima_prophet_adapter).\n",
"* Fit 10 benchmark models on **1,000,000** series in [under **5 min**](./experiments/benchmarks_at_scale/). \n",
"\n",
"\n",
"\n",
"Missing something? Please open an issue or write us in [![Slack](https://img.shields.io/badge/Slack-4A154B?&logo=slack&logoColor=white)](https://join.slack.com/t/nixtlaworkspace/shared_invite/zt-135dssye9-fWTzMpv2WBthq8NK0Yvu6A)\n"
]
},
{
"cell_type": "markdown",
"id": "a8a9d04c-f064-43d3-8eae-39b69d8afb9e",
"id": "25bb6293",
"metadata": {},
"source": [
"## Why? \n",
"## Models\n",
"\n",
"Current Python alternatives for statistical models are slow, inaccurate and don't scale well. So we created a library that can be used to forecast in production environments or as benchmarks. `StatsForecast` includes an extensive battery of models that can efficiently fit millions of time series."
]
},
{
"cell_type": "markdown",
"id": "566e6ea0-0174-42a3-94c1-4d1d14591823",
"metadata": {},
"source": [
"## Accuracy & Speed \n",
"### Automatic Forecasting\n",
"Automatic forecasting tools search for the best parameters and select the best possible model for a series of time series. These tools are useful for large collections of univariate time series.\n",
"\n",
"|Model | Point Forecast | Probabilistic Forecast | Insample fitted values | Probabilistic fitted values |\n",
"|:------|:-------------:|:----------------------:|:---------------------:|:----------------------------:|\n",
"|[AutoARIMA](../models.html#autoarima)|✅|✅|✅|✅|✅|\n",
"|[AutoETS](../models.html#autoets)|✅|✅|✅|✅|✅|\n",
"|[AutoCES](../models.html#autoces)|✅||✅|||\n",
"|[AutoTheta](../models.html#autotheta)|✅|✅|✅|✅|✅|\n",
": {tbl-colwidths=\"[75,25]\"}\n",
"\n",
"### Theta Family\n",
"fit two theta lines to a deseasonalized time series, using different techniques to obtain and combine the two theta lines to produce the final forecasts.\n",
"\n",
"|Model | Point Forecast | Probabilistic Forecast | Insample fitted values | Probabilistic fitted values |\n",
"|:------|:-------------:|:----------------------:|:---------------------:|:----------------------------:|\n",
"|[Theta](../models.html#theta)|✅|✅|✅|✅|✅|\n",
"|[OptimizedTheta](../models.html#optimizedtheta)|✅|✅|✅|✅|✅|\n",
"|[DynamicTheta](../models.html#dynamictheta)|✅|✅|✅|✅|✅|\n",
"|[DynamicOptimizedTheta](../models.html#dynamicoptimizedtheta)|✅|✅|✅|✅|✅|\n",
": {tbl-colwidths=\"[75,25]\"}\n",
"\n",
"\n",
"### Multiple Seasonalities\n",
"Suited for signals with more than one clear seasonality. Useful for low-frequency data like electricity and logs.\n",
"\n",
"### ARIMA \n",
"The `AutoARIMA` model implemented in `StatsForecast` is **20x faster** than `pmdarima` and **1.5x faster** than `R` while improving accuracy. You can see the exact comparison and reproduce the results [here](./experiments/arima/).\n",
"|Model | Point Forecast | Probabilistic Forecast | Insample fitted values | Probabilistic fitted values |\n",
"|:------|:-------------:|:----------------------:|:---------------------:|:----------------------------:|\n",
"|[MSTL](../models.html#mstl)|✅|✅|✅|✅|✅|\n",
": {tbl-colwidths=\"[75,25]\"}\n",
"\n",
"### ETS\n",
"### Baseline Models\n",
"Classical models for establishing baseline.\n",
"\n",
"StatsForecast's `ETS` is **4x faster than StatsModels'** and **1.6x faster than R's**, with improved accuracy and robustness. You can see the exact comparison and reproduce the results[here](./experiments/ets/)\n",
"|Model | Point Forecast | Probabilistic Forecast | Insample fitted values | Probabilistic fitted values |\n",
"|:------|:-------------:|:----------------------:|:---------------------:|:----------------------------:|\n",
"|[HistoricAverage](../models.html#historicaverage)|✅|✅|✅|✅|✅|\n",
"|[Naive](../models.html#naive)|✅|✅|✅|✅|✅|\n",
"|[RandomWalkWithDrift](../models.html#randomwalkwithdrift)|✅|✅|✅|✅|✅|\n",
"|[SeasonalNaive](../models.html#seasonalnaive)|✅|✅|✅|✅|✅|\n",
"|[WindowAverage](../models.html#windowaverage)|✅|||||\n",
"|[SeasonalWindowAverage](../models.html#seasonalwindowaverage)|✅|||||\n",
": {tbl-colwidths=\"[75,25]\"}\n",
"\n",
"### Benchmarks at Scale\n",
"### Exponential Smoothing\n",
"Uses a weighted average of all past observations where the weights decrease exponentially into the past. Suitable for data with no clear trend or seasonality.\n",
"\n",
"With `StatsForecast` you can fit 9 benchmark models on **1,000,000** series in under **5 min**. Reproduce the results [here](./experiments/benchmarks_at_scale/). \n"
"|Model | Point Forecast | Probabilistic Forecast | Insample fitted values | Probabilistic fitted values |\n",
"|:------|:-------------:|:----------------------:|:---------------------:|:----------------------------:|\n",
"|[SimpleExponentialSmoothing](../models.html#simpleexponentialsmoothing)|✅|||||\n",
"|[SimpleExponentialSmoothingOptimized](../models.html#simpleexponentialsmoothingoptimized)|✅|||||\n",
"|[SeasonalExponentialSmoothing](../models.html#seasonalexponentialsmoothing)|✅|||||\n",
"|[SeasonalExponentialSmoothingOptimized](../models.html#seasonalexponentialsmoothingoptimized)|✅|||||\n",
"|[Holt](../models.html#holt)|✅|✅|✅|✅|✅|\n",
"|[HoltWinters](../models.html#holtwinters)|✅|✅|✅|✅|✅|\n",
": {tbl-colwidths=\"[75,25]\"}\n",
"\n",
"\n",
"\n",
"\n",
"### Sparse of Inttermitent\n",
"Suited for series with very few non-zero observations\n",
"\n",
"|Model | Point Forecast | Probabilistic Forecast | Insample fitted values | Probabilistic fitted values |\n",
"|:------|:-------------:|:----------------------:|:---------------------:|:----------------------------:|\n",
"|[ADIDA](../models.html#adida)|✅|||||\n",
"|[CrostonClassic](../models.html#crostonclassic)|✅|||||\n",
"|[CrostonOptimized](../models.html#crostonoptimized)|✅|||||\n",
"|[CrostonSBA](../models.html#crostonsba)|✅|||||\n",
"|[IMAPA](../models.html#imapa)|✅|||||\n",
"|[TSB](../models.html#tsb)|✅|||||\n",
": {tbl-colwidths=\"[75,25]\"}\n",
"\n"
]
},
{
"cell_type": "markdown",
"id": "8f2477d4-7935-468d-8805-fc674c28461e",
"id": "b51b7fbd",
"metadata": {},
"source": [
"## Examples and Guides\n",
"\n",
"📚 [End to End Walkthrough](https://nixtla.github.io/statsforecast/examples/getting_started_complete.html): Model training, evaluation and selection for multiple time series\n",
"\n",
"## Getting Started \n",
"You can run this notebooks to get you started. \n",
"🔎 [Anomaly Detection](https://nixtla.github.io/statsforecast/examples/anomalydetection.html): detect anomalies for time series using in-sample prediction intervals.\n",
"\n",
"* Example of different `AutoARIMA` models on M4 data [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/nixtla/statsforecast/blob/main/nbs/examples/AutoArima_vs_Prophet.ipynb) \n",
" * In this notebook we present Nixtla's `AutoARIMA`. \n",
" The `AutoARIMA` model is widely used to forecast time series in production and as a benchmark. However, the alternative python implementation (`pmdarima`) is so slow that prevents data scientists from quickly iterating and deploying `AutoARIMA` in production for a large number of time series. \n",
"👩‍🔬 [Cross Validation](https://nixtla.github.io/statsforecast/examples/crossvalidation.html): robust model’s performance evaluation.\n",
"\n",
"* Shorter Example of fitting and `AutoARIMA` and an `ETS` model. [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/nixtla/statsforecast/blob/main/nbs/examples/Getting_Started_with_Auto_Arima_and_ETS.ipynb)\n",
"❄️ [Multiple Seasonalities](https://nixtla.github.io/statsforecast/examples/multipleseasonalities.html): how to forecast data with multiple seasonalities using an MSTL.\n",
"\n",
"🔌 [Predict Demand Peaks](https://nixtla.github.io/statsforecast/examples/electricitypeakforecasting.html): electricity load forecasting for detecting daily peaks and reducing electric bills.\n",
"\n",
"* Benchmarking 9 models on millions of [series](./experiments/benchmarks_at_scale/)."
"📈 [Intermittent Demand](https://nixtla.github.io/statsforecast/examples/intermittentdata.html): forecast series with very few non-zero observations. \n",
"\n",
"🌡️ [Exogenous Regressors](https://nixtla.github.io/statsforecast/examples/exogenous.html): like weather or prices\n",
"\n",
"\n",
"\n"
]
},
{
Expand All @@ -174,24 +266,22 @@
"## How to contribute\n",
"See [CONTRIBUTING.md](https://github.com/Nixtla/statsforecast/blob/main/CONTRIBUTING.md)."
]
},
{
"cell_type": "markdown",
"id": "880c61b7-ec48-428d-8668-54c9114a51a1",
"metadata": {},
"source": [
"## References\n",
"\n",
"* The `AutoARIMA` model is based (translated) from the R implementation included in the [forecast](https://github.com/robjhyndman/forecast) package developed by Rob Hyndman.\n",
"* The `ETS` model is based (translated) from the R implementation included in the [forecast](https://github.com/robjhyndman/forecast) package developed by Rob Hyndman."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3.7.12 ('autots-ui')",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.7.12"
},
"vscode": {
"interpreter": {
"hash": "53c8f8a6920a4d601e2858165ee48357c21f0198d63d0b9031b8177ea1f99a56"
}
}
},
"nbformat": 4,
Expand Down

0 comments on commit 1e2bd49

Please sign in to comment.