Skip to content

Commit

Permalink
fix(example): add notebook examples
Browse files Browse the repository at this point in the history
  • Loading branch information
LongxingTan authored Jan 21, 2025
1 parent 817456a commit 541e399
Show file tree
Hide file tree
Showing 31 changed files with 1,328 additions and 1,235 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ model = AutoModel.from_config(config, predict_sequence_length=7)

**Build your own model**

<details><summary> Full list of model tfts supported using AutoModel </summary>
<details><summary> Full list of tfts AutoModel supported </summary>

- rnn
- tcn
Expand All @@ -212,7 +212,7 @@ model = AutoModel.from_config(config, predict_sequence_length=7)

</details>

You could build the custom model based on tfts, especially
You could build the custom model based on tfts, like
- add custom-defined embeddings for categorical variables
- add custom-defined head layers for classification or anomaly task

Expand Down
14 changes: 7 additions & 7 deletions docs/source/tricks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ There is no free launch, and it's impossible to forecast the future. So we shoul

we can train different models from different scale

* module usage

Multi-steps prediction strategy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Be careful to use the layer like `Dropout` or `BatchNorm` for regression task

* multi models

* add a hidden-sizes dense layer at last
* Multi-steps prediction strategy

* encoder-decoder structure

* encoder-forecasting structure
* multi models for single variable prediction
* add a hidden-sizes dense layer at last
* encoder-decoder structure
* encoder-forecasting structure
15 changes: 10 additions & 5 deletions docs/source/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Tutorials

<a class="github-button" href="https://github.com/LongxingTan/Time-series-prediction" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star LongxingTan/Time-series-prediction on GitHub">GitHub</a>

The following tutorials can be also found as `notebooks on GitHub <https://github.com/longxingtan/time-series-prediction/tree/master/notebooks>`_.
The following tutorials can be also found as `notebooks on GitHub <https://github.com/longxingtan/time-series-prediction/tree/master/examples/notebooks>`_.

.. _prepare_data:

Expand Down Expand Up @@ -51,6 +51,10 @@ input 1
Train the models
-----------------

- Multi-GPU training with `tf.distribute <https://www.tensorflow.org/guide/keras/distributed_training>`_
- Mixed precision with `tf.keras.mixed_precision <https://www.tensorflow.org/guide/mixed_precision>`_


.. code-block:: python
import tensorflow as tf
Expand Down Expand Up @@ -90,7 +94,8 @@ Change the model parameters. If you want touch more parameters in model config,
"rnn_size": 128,
"dense_size": 128,
}
model = AutoModel('rnn', custom_model_config=custom_model_config)
config.update(custom_model_config)
model = AutoModel('rnn', config=config)
Multi-variables and multi-steps prediction
Expand All @@ -106,8 +111,8 @@ Multi-variables and multi-steps prediction
print(config)
config.update({
"rnn_size": 128,
"dense_size": 128,
"rnn_size": 128,
"dense_size": 128,
})
print(config)
Expand Down Expand Up @@ -154,7 +159,7 @@ Set up the custom-defined head layer to do the classification task or anomaly de
Custom-defined trainer
----------------------------------------

You could use tfts trainer, a custom trainer or use keras to train directly.
You could use `tfts trainer`, `custom trainer` or use keras to train directly.

.. code-block:: python
Expand Down
6 changes: 6 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# TFTS examples

**Basic Usage**
- [time series prediction](./run_prediction_simple.py)
- [time series anomaly detection](./run_anomaly.py)


## Notebooks
- [single step prediction](https://nbviewer.org/github/LongxingTan/Time-series-prediction/blob/master/examples/notebooks/demo_single_step_prediction.ipynb)


## More examples

**Multiple steps prediction**
- [TFTS-Bert](https://github.com/LongxingTan/KDDCup2022-Baidu) wins the **3rd place** in KDD Cup 2022 wind power forecasting
- [TFTS-Seq2seq](https://github.com/LongxingTan/Data-competitions/tree/master/tianchi-enso-prediction) wins the **4th place** in Tianchi ENSO prediction 2021
Loading

0 comments on commit 541e399

Please sign in to comment.