Skip to content

Commit 01e39b3

Browse files
authored
tests: update unit
1 parent 75dbfb3 commit 01e39b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+482
-207
lines changed

.github/workflows/pypi_release.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
name: PyPi Release
55

66
on:
7-
# push:
8-
# branches: [master]
97
release:
108
types: [created]
119

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
matrix:
1717
os: [ubuntu-latest, macOS-latest] # add windows-2019 when poetry allows installation with `-f` flag
18-
python-version: [3.9, '3.11']
18+
python-version: [3.9, '3.12']
1919
tf-version: [2.13.1, 2.15.1]
2020

2121
exclude:
@@ -92,7 +92,7 @@ jobs:
9292
- name: Set up Python
9393
uses: actions/setup-python@v5
9494
with:
95-
python-version: '3.10'
95+
python-version: '3.12'
9696

9797
- name: Create pip cache directory manually
9898
run: |

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
[![Code Coverage][coverage-image]][coverage-url]
3030
[![Contributing][contributing-image]][contributing-url]
3131

32-
**[Documentation](https://time-series-prediction.readthedocs.io)** | **[Tutorials](https://time-series-prediction.readthedocs.io/en/latest/tutorials.html)** | **[Release Notes](https://time-series-prediction.readthedocs.io/en/latest/CHANGELOG.html)** | **[中文](https://github.com/LongxingTan/Time-series-prediction/blob/master/README_CN.md)**
32+
**[Documentation](https://time-series-prediction.readthedocs.io)** | **[Tutorials](https://time-series-prediction.readthedocs.io/en/latest/tutorials.html)** | **[Release Notes](./CHANGELOG.md)** | **[中文](https://github.com/LongxingTan/Time-series-prediction/blob/master/README_CN.md)**
3333

3434
**TFTS** (TensorFlow Time Series) is an easy-to-use time series package, supporting the classical and latest deep learning methods in TensorFlow or Keras.
3535
- Support sota models for time series tasks (prediction, classification, anomaly detection)

README_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
[![Code Coverage][coverage-image]][coverage-url]
3030
[![Contributing][contributing-image]][contributing-url]
3131

32-
**[文档](https://time-series-prediction.readthedocs.io)** | **[教程](https://time-series-prediction.readthedocs.io/en/latest/tutorials.html)** | **[发布日志](https://time-series-prediction.readthedocs.io/en/latest/CHANGELOG.html)** | **[English](https://github.com/LongxingTan/Time-series-prediction/blob/master/README.md)**
32+
**[文档](https://time-series-prediction.readthedocs.io)** | **[教程](https://time-series-prediction.readthedocs.io/en/latest/tutorials.html)** | **[发布日志](./CHANGELOG.md)** | **[English](https://github.com/LongxingTan/Time-series-prediction/blob/master/README.md)**
3333

3434
青山遮不住,毕竟东流去。江晚正愁余,山深闻鹧鸪。<br>
3535
**东流TFTS** (TensorFlow Time Series) 是一个高效易用的时间序列框架,基于TensorFlow/ Keras。

docs/source/models.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,16 @@ You can use below models with ``AutoModel``
2828
2929
config = AutoConfig.for_model("seq2seq")
3030
model = AutoModel.from_config(config, predict_sequence_length=predict_sequence_length)
31+
32+
33+
Add a custom head for tfts model
34+
35+
.. code-block:: python
36+
37+
config = AutoConfig.for_model("seq2seq")
38+
model = AutoModel.from_config(config, predict_sequence_length=predict_sequence_length)
39+
model.project = tf.keras.Sequential(
40+
layers=[],
41+
trainable=True,
42+
name=None
43+
)

docs/source/tricks.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,28 @@ There is no free launch, and it's impossible to forecast the future. So we shoul
4545
* add a hidden-sizes dense layer at last
4646
* encoder-decoder structure
4747
* encoder-forecasting structure
48+
49+
50+
.. code-block:: python
51+
52+
# use tfts auto-regressive generate multiple steps
53+
from tfts.data import TimeSeriesSequence
54+
# Generate predictions
55+
last_sequence = data.tail(10)
56+
57+
# Function to add features after each prediction
58+
def add_features(new_df, history_df):
59+
# Add any features needed for the next prediction
60+
# For example, you could add lag features, moving averages, etc.
61+
return new_df
62+
63+
# Generate predictions
64+
predictions = model.generate(
65+
last_sequence,
66+
generation_config={
67+
'steps': 30,
68+
'time_idx': 'time_idx',
69+
'time_step': 1,
70+
'add_features_func': add_features
71+
}
72+
)

tests/test_data/test_timeseries.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Tests for TimeSeriesSequence class."""
22

3-
from datetime import datetime, timedelta
43
import unittest
54

65
import numpy as np

tests/test_examples/test_tfts_inputs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import unittest
33

44
import numpy as np
5-
import pandas as pd
65
import tensorflow as tf
76

87
from tfts import AutoConfig, AutoModel, KerasTrainer

tests/test_features/test_datetime_feature.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Tests for datetime features."""
22

3-
from datetime import datetime, timedelta
43
import unittest
54

65
import numpy as np

tests/test_features/test_one_order_feature.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Tests for one-order features."""
22

3-
from datetime import datetime, timedelta
43
import unittest
54

65
import numpy as np

0 commit comments

Comments
 (0)