Skip to main content

pypi license

English/日本語

(documentations)

❓ About this project

tsts is an open source project that provides state-of-the-art time series forecasting methods.

It allows for more flexible model building, such as building models in combination with autoregressive (AR) models and deep learning models. In addition to models, tsts also provides the latest modules for data augmentation, loss functions, and optimizers, etc.

⛏ Installation

pip install tsts

Or install the development version by

pip install git+https://github.com/takuyashintate/tsts

⚡️Config Samples

See samples for examples of how each model is used.

🚀 Getting Started

If you want to measure the performance of your model on a given benchmark, see "Using tools/train.py & tools/test.py" or "Using the API" if you want to make predictions online.

Using tools/train.py & tools/test.py

✅ Less code is required for learning & inference

1. Preparation of data to be used for training

Save the training data (CSV files), validation data, and test data in their respective directories. The name of the directory is arbitrary. If there are multiple training, validation, and test data, please save them all in their respective directories.

2. Create a config file

Create a config file describing the settings during training. You can specify the model, Data Augmentation, Optimizer, Learning Rate Scheduler, etc. See documentations for details on the possible configuration items.

For simplicity, we will use a minimal config file here. Save the following as my_first_model.yml. You can use a different model or methodology by copying the target section from documentations.

# Save as `my_first_model.yml`
LOGGER:
  LOG_DIR: "my-first-model"

3. Training

Execute the command below to begin training. Once training begins, model parameters and a log file will be created in the directory specified in 2 (my-first-model here). The log file will contain loss and metric values for each epoch.

Loss functions and metrics can be changed as well as models

Specify the directory where the training and validation data are stored in --train-dir and --valid-dir. Specify a list of input variable names and a list of output variable names in --in-feats and --out-feats.

Sometimes you may want to predict the value of an output variable at the same time as the input variable (i.e., you want to predict the value of an output variable at time t-n to t for the value of an input variable at time t-n to t). In such cases, add the --lagging option.

python tools/train.py \
    --cfg-name my_first_model.yml \
    --train-dir <dir to contain training data> \
    --valid-dir <dir to contain validation data> \
    --in-feats <list of input feature names> \
    --out-feats <list of output feature names>

4. Testing a trained model

After training is complete, the command below can be executed to obtain the prediction results for the test data. CSV files containing the prediction results, the correct labels, and their errors will be saved in the directory specified by --out-dir, and images of them plotted. Results are saved for each test data.

python tools/test.py \
    --cfg-name my_first_model.yml \
    --train-dir <dir to contain training data> \
    --valid-dir <dir to contain validation data> \
    --test-dir <dir to contain test data> \
    --in-feats <list of input feature names> \
    --out-feats <list of output feature names> \
    --out-dir <result is saved in this directory>

Using API

✅ Can be used to predict future values

1~3. Data Preparation ~ Learning

Same procedure as when using tools/train.py & tools/test.py.

4. Testing a trained model

Forecasts are made with arbitrary values with a trained model.

Size of input values must be of (number of time steps, number of variables)

from tsts.apis import init_forecaster, run_forecaster
from tsts.utils import plot


(solver, X_scaler, y_scaler) = init_forecaster(
    cfg_name,  # config file (like "my_first_model.yml")
    train_dir,  # dir to contain training data
    in_feats,  # list of input feature names
    out_feats,  # list of output feature names
)
Z = run_forecaster(
    solver,
    X_scaler,
    y_scaler,
    X,  # torch.Tensor of (number of time steps, number of variables)
)
plot(Z)

Metadata

Release files for tsts 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for tsts 1.1.3
File Interpreter ABI Platform
tsts-1.1.3-py3-none-any.whl Python 3 none any Details

Release files / tsts-1.1.3-py3-none-any.whl

Download URL tsts-1.1.3-py3-none-any.whl
Size 71.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c7173a4990dddd4a53d89e4ce85cee09dea14f5968cc83fecc8a2d3bc9f63d8
BLAKE2b-256 checksum
How to use checksums
35782cf0eacbda3bddc9a7e7c851ae2671590233d37be44f0810262f27abe49a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/3.10.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3

Release history Release notifications | RSS feed

This release

1.1.3 This release

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.0

1 release file

0.10.0

1 release file

0.9.0

1 release file

0.8.3

1 release file

0.8.2

1 release file

0.8.1

1 release file

0.8.0

1 release file

0.7.1

1 release file

0.7.0

1 release file

0.6.0

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.3.0

1 release file

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page