from tsfast.basics import *
= create_dls_silverbox()
dls =1) dls.show_batch(max_n
TSFast
Description
tsfast
is an open-source deep learning library for time series analysis and system identification tasks. Built on PyTorch & fastai, it offers efficient deep learning models and utilities.
tsfast
is an open-source deep learning package that focuses on system identification and time series analysis tasks. Built on the foundations of PyTorch and fastai, it provides efficient implementations of various deep learning models and utilities.
Key Features
- Specialized Data Handling for Time Series:
- Employs
SequenceBlock
(built onfastai.TransformBlock
) for robust sequence data processing pipelines. - Includes a range of transforms tailored for sequences, such as
SeqSlice
,SeqNoiseInjection
, andNormalize
adapted for time series tensors. - Features advanced data loading with
TbpttDl
(for Truncated Backpropagation Through Time), and factories forWeightedDL
andBatchLimitDL
.
- Employs
- Predefined Datasets & Helpers: Offers easy-to-use benchmark datasets (e.g.,
create_dls_silverbox
fromidentibench
) for rapid prototyping and experimentation. - Tailored Time Series Models: Provides implementations of Recurrent Neural Networks (RNNs, including
DenseNet_RNN
,ResidualBlock_RNN
), Convolutional Neural Networks (TCNs,CausalConv1d
), and combined architectures (CRNN
,SeperateCRNN
) specifically designed for sequence modeling. Includes building blocks likeSeqLinear
and stateful batch normalization. - Integrated
fastai
Learner: FeaturesRNNLearner
,TCNLearner
,CRNNLearner
, etc., extendingfastai
’sLearner
for streamlined model training, equipped with custom time-series losses (e.g.,fun_rmse
,nrmse
) and callbacks (e.g.,TbpttResetCB
,ARInitCB
,SkipFirstNCallback
). - System Identification & Prediction:
- Supports simulation (prediction based on inputs) and N-step ahead forecasting.
- Includes specialized models and callbacks for system identification tasks like FRANSYS (
FranSys
,FranSysCallback
) and AR models (AR_Model
,ARProg
). - Provides an
InferenceWrapper
for easier model deployment and prediction.
- Hyperparameter Optimization: Integrates with Ray Tune via
HPOptimizer
for efficient hyperparameter searching.
Installation
You can install the latest stable version from pip using:
pip install tsfast
For development installation:
//github.com/daniel-om-weber/tsfast
git clone https:
cd tsfast-e '.[dev]' pip install
Quick Start
Here is a quick example using a benchmark dataloader. It demonstrates loading and visualizing data, training a RNN, and visualizing the results.
= RNNLearner(dls)
lrn 1) lrn.fit_flat_cos(
epoch | train_loss | valid_loss | fun_rmse | time |
---|---|---|---|---|
0 | 0.006716 | 0.006925 | 0.015471 | 01:55 |
=1) lrn.show_results(max_n
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Citation
If you use tsfast in your research, please cite:
@Misc{tsfast,
author = {Daniel O.M. Weber},
title = {tsfast - A deep learning library for time series analysis and system identification},
howpublished = {Github},
year = {2024},
url = {https://github.com/daniel-om-weber/tsfast}
}