From 56e94eda59a325e54a635f0b7a916aeec9e1573f Mon Sep 17 00:00:00 2001 From: Junwei Deng <35031544+TheaperDeng@users.noreply.github.com> Date: Tue, 3 Jan 2023 15:00:27 +0800 Subject: [PATCH] Chronos: add forecaster alg choose guide and some cleaning for how to guide (#7139) * fix format * fix * update * update --- docs/readthedocs/source/_toc.yml | 1 + .../Howto/how_to_choose_forecasting_alg.md | 48 +++++++++++++++++++ .../source/doc/Chronos/Howto/index.rst | 31 ++++++++---- .../doc/Chronos/Overview/forecasting.md | 12 ++++- 4 files changed, 82 insertions(+), 10 deletions(-) create mode 100644 docs/readthedocs/source/doc/Chronos/Howto/how_to_choose_forecasting_alg.md diff --git a/docs/readthedocs/source/_toc.yml b/docs/readthedocs/source/_toc.yml index b5e98192..d81ec6ca 100644 --- a/docs/readthedocs/source/_toc.yml +++ b/docs/readthedocs/source/_toc.yml @@ -203,6 +203,7 @@ subtrees: - file: doc/Chronos/Howto/how_to_export_torchscript_files - file: doc/Chronos/Howto/how_to_preprocess_my_data - file: doc/Chronos/Howto/how_to_process_data_in_production_environment + - file: doc/Chronos/Howto/how_to_choose_forecasting_alg - file: doc/Chronos/QuickStart/index title: "Tutorials" subtrees: diff --git a/docs/readthedocs/source/doc/Chronos/Howto/how_to_choose_forecasting_alg.md b/docs/readthedocs/source/doc/Chronos/Howto/how_to_choose_forecasting_alg.md new file mode 100644 index 00000000..a1b5fa4f --- /dev/null +++ b/docs/readthedocs/source/doc/Chronos/Howto/how_to_choose_forecasting_alg.md @@ -0,0 +1,48 @@ +# Choose proper forecasting model + +How to choose a forecasting model among so many built-in models (or build one by yourself) in Chronos? That's a common question when users want to build their first forecasting model. Different forecasting models are more suitable for different data and different metrics(accuracy or performances). + +The flowchart below is designed to guide our users which forecasting model to try on your own data. Click on the blocks in the chart below to see its documentation/examples. + +```eval_rst +.. note:: + + Following flowchart may need some time to load. +``` + + +```eval_rst +.. mermaid:: + + flowchart TD + StartPoint[I want to build a forecasting model] + StartPoint-- always start from --> TCN[TCNForecaster] + TCN -- performance is not satisfying --> TCN_OPT[Make sure optimizations are deploied] + TCN_OPT -- further performance improvement is needed --> SER[Performance-awared Hyperparameter Optimization] + SER -- only 1 step to be predicted --> LSTMForecaster + SER -- only 1 var to be predicted --> NBeatsForecaster + LSTMForecaster -- does not work --> CUS[customized model] + NBeatsForecaster -- does not work --> CUS[customized model] + + TCN -- accuracy is not satisfying --> Tune[Hyperparameter Optimization] + Tune -- only 1 step to be predicted --> LSTMForecaster2[LSTMForecaster] + LSTMForecaster2 -- does not work --> AutoformerForecaster + Tune -- more than 1 step to be predicted --> AutoformerForecaster + AutoformerForecaster -- does not work --> Seq2SeqForecaster + Seq2SeqForecaster -- does not work --> CUS[customized model] + + click TCN "https://bigdl.readthedocs.io/en/latest/doc/Chronos/Overview/forecasting.html#tcnforecaster" + click LSTMForecaster "https://bigdl.readthedocs.io/en/latest/doc/Chronos/Overview/forecasting.html#lstmforecaster" + click LSTMForecaster2 "https://bigdl.readthedocs.io/en/latest/doc/Chronos/Overview/forecasting.html#lstmforecaster" + click NBeatsForecaster "https://bigdl.readthedocs.io/en/latest/doc/Chronos/Overview/forecasting.html#nbeatsforecaster" + click Seq2SeqForecaster "https://bigdl.readthedocs.io/en/latest/doc/Chronos/Overview/forecasting.html#seq2seqforecaster" + click AutoformerForecaster "https://bigdl.readthedocs.io/en/latest/doc/Chronos/Overview/forecasting.html#AutoformerForecaster" + + click TCN_OPT "https://bigdl.readthedocs.io/en/latest/doc/Chronos/Overview/speed_up.html" + click SER "https://github.com/intel-analytics/BigDL/blob/main/python/chronos/example/hpo/muti_objective_hpo_with_builtin_latency_tutorial.ipynb" + click Tune "https://bigdl.readthedocs.io/en/latest/doc/Chronos/Howto/how_to_tune_forecaster_model.html" + click CUS "https://bigdl.readthedocs.io/en/latest/doc/Chronos/Overview/speed_up.html" + + classDef Model fill:#FFF,stroke:#0f29ba,stroke-width:1px; + class TCN,LSTMForecaster,NBeatsForecaster,LSTMForecaster2,AutoformerForecaster,Seq2SeqForecaster Model; +``` \ No newline at end of file diff --git a/docs/readthedocs/source/doc/Chronos/Howto/index.rst b/docs/readthedocs/source/doc/Chronos/Howto/index.rst index 9b6fcb86..f600e9d8 100644 --- a/docs/readthedocs/source/doc/Chronos/Howto/index.rst +++ b/docs/readthedocs/source/doc/Chronos/Howto/index.rst @@ -2,33 +2,46 @@ Chronos How-to Guides ========================= How-to guides are bite-sized, executable examples where users could check when meeting with some specific topic during the usage. -Install +Installation ------------------------- * `Install Chronos on Windows `__ * `Use Chronos in container(docker) `__ +Data Processing +------------------------- +* `Preprocess my data `__ + + Forecasting ------------------------- +Develop a forecaster +~~~~~~~~~~~~~~~~~~~~~~~~~ +* `Choose a forecaster algorithm `__ * `Create a forecaster `__ * `Train forecaster on single node `__ -* `Save and load a forecaster `__ * `Tune forecaster on single node `__ -* `Speed up inference of forecaster through ONNXRuntime `__ -* `Speed up inference of forecaster through OpenVINO `__ * `Evaluate a forecaster `__ * `Use forecaster to predict future data `__ * `Generate confidence interval for prediction `__ + +Speed up a forecaster +~~~~~~~~~~~~~~~~~~~~~~~~~ +* `Speed up inference of forecaster through ONNXRuntime `__ +* `Speed up inference of forecaster through OpenVINO `__ + +Persist a forecaster +~~~~~~~~~~~~~~~~~~~~~~~~~ +* `Save and load a forecaster `__ * `Export the ONNX model files to disk `__ * `Export the OpenVINO model files to disk `__ * `Export the TorchScript model files to disk `__ -* `Preprocess my data `__ -Benchmark -------------------------- +Benchmark a forecaster +~~~~~~~~~~~~~~~~~~~~~~~~~ * `Use Chronos benchmark tool `__ -Deployment -------------------------- +Deploy a forecaster +~~~~~~~~~~~~~~~~~~~~~~~~~ * `A whole workflow in production environment after my forecaster is developed `__ diff --git a/docs/readthedocs/source/doc/Chronos/Overview/forecasting.md b/docs/readthedocs/source/doc/Chronos/Overview/forecasting.md index 76bca897..52c1cdca 100644 --- a/docs/readthedocs/source/doc/Chronos/Overview/forecasting.md +++ b/docs/readthedocs/source/doc/Chronos/Overview/forecasting.md @@ -29,7 +29,8 @@ Besides, _Chronos_ also provides **benchmark tool** to benchmark forecasting per | ----------------- | ----- | ------------- | ---------- | ------- | ----------- | ----------- | ----------- | ----------- | ----------- | ----------- | | LSTM | RR | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | pytorch/tf2 | | Seq2Seq | RR | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | pytorch/tf2 | -| TCN | RR | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | pytorch | +| TCN | RR | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | pytorch/tf2 | +| Autoformer | RR | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | pytorch | | NBeats | RR | ❌ | ✅ | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ | pytorch | | MTNet | RR | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | ✳️\*\* | tf2 | | TCMF | TS | ✅ | ✅ | ✅ | ✳️\* | ❌ | ❌ | ❌ | ❌ | pytorch | @@ -258,6 +259,15 @@ View Stock Prediction [notebook][stock_prediction_prophet] and [ProphetForecaste Neural basis expansion analysis for interpretable time series forecasting ([N-BEATS](https://arxiv.org/abs/1905.10437)) is a deep neural architecture based on backward and forward residual links and a very deep stack of fully-connected layers. Nbeats can solve univariate time series point forecasting problems, being interpretable, and fast to train. +[NBeatsForecaster API Doc](../../PythonAPI/Chronos/forecasters.html#nbeatsforecaster) for more details. + + +##### 3.9 AutoformerForecaster + +Autoformer: Decomposition Transformers with Auto-Correlation for Long-Term Series Forecasting ([Autoformer](https://arxiv.org/abs/2106.13008)) is a Transformer based neural network that could reach SOTA results on many datasets. + +[AutoformerForecaster API Doc](../../PythonAPI/Chronos/forecasters.html#autoformerforecaster) for more details. + #### 4. Use Auto forecasting model Auto forecasting models are designed to be used exactly the same as Forecasters. The only difference is that you can set hp search function to the hyperparameters and the `.fit()` method will search the best hyperparameter setting. ```python