【机器学习】开源时间序列工具包汇总

机器学习初学者

共 15723字,需浏览 32分钟

 ·

2024-06-21 12:00

作者:杰

开源时间序列工具包汇总。

01


TSFresh(6.3k+)

  • https://tsfresh.readthedocs.io/en/latest/

tsfresh是一个python包,它会自动计算大量的时间序列特征。此外,该软件包还包含评估此类特征对回归或分类任务的解释能力和重要性的方法。tsfresh可以自动提取特征构建特征。如下图所示,tsfresh可以自动从时间序列中提取100秒的特征。这些特征描述了时间序列的基本特征,如

  • 峰值数量;
  • 平均值或最大值;
  • 更复杂的特征,如时间反转对称性统计。

这些特征可以用来构建时间序列上的统计或机器学习模型,例如用于回归或分类任务。

02


Sktime(5.2k+)

Sktime是Python中用于时间序列分析的库。它为多个时间序列学习任务提供了统一的界面。目前,这包括:

  • 时间序列分类、回归、聚类、预测等。

它配有时间序列算法和scikit learn兼容工具,用于构建、调整和验证时间序列模型。

目前Sktime包含了大量的时间序列模型,详见:https://www.sktime.org/en/stable/estimator_overview.html

03


TSlib(4.9k+)

Time Series Library (TSlib)(4.9K+)

TSlib是一个开源库,专为深度学习研究人员设计,特别是深度时间序列分析。

我们提供了一个整洁的代码库,用于评估先进的深度时间序列模型或开发您自己的模型,涵盖了五个主流任务:长期和短期预测、填充、异常检测和分类。

截止2024年,五个不同任务的最佳三个模型如下:

详情参考:https://github.com/thuml/Time-Series-Library

04


Darts(3.9k)

Darts(GitHub:3.9K+)

  • https://github.com/unit8co/darts

Darts是一个Python库,要求Python 3.7及以上版本为佳,Darts包含非常多的模型,从经典的ARIMA到深度神经网络。

  • Darts中的模型可以以只饿极使用fit()和predict()函数,类似于scikit learn。
  • Darts可以方便地对模型进行回溯测试,组合多个模型的预测,并加入外部数据。
  • Darts支持单变量和多变量时间序列和模型。


Darts中包含的模型列表如下:

Model Univariate Multivariate Probabilistic Multiple-series training Past-observed covariates support Future-known covariates support Reference
ARIMA



VARIMA



AutoARIMA




StatsForecastAutoARIMA (faster AutoARIMA)


statsforecast
ExponentialSmoothing




BATS and TBATS



TBATS paper
Theta and FourTheta




Theta & 4 Theta
Prophet


Prophet repo
FFT (Fast Fourier Transform)





KalmanForecaster using the Kalman filter and N4SID for system identification

N4SID paper
Croston method





RegressionModel; generic wrapper around any sklearn regression model

RandomForest

LinearRegressionModel
LightGBMModel
RNNModel (incl. LSTM and GRU); equivalent to DeepAR in its probabilistic version
DeepAR paper
BlockRNNModel (incl. LSTM and GRU)

NBEATSModel
N-BEATS paper
NHiTS
N-HiTS paper
TCNModel
TCN paper, DeepTCN paper, blog post
TransformerModel

TFTModel (Temporal Fusion Transformer) TFT paper, PyTorch Forecasting
Naive Baselines





05


Kats(3.6k+)

  • https://github.com/facebookresearch/Kats

Kats是一个分析时间序列数据的工具包,是一个轻量级、易于使用而且具有非常好泛化能力的框架,用于执行时间序列分析。

Kats旨在为时间序列分析提供一站式服务,包括检测、预测、特征提取/嵌入、多元分析等


06


GluonTS(2.6k+)

  • https://github.com/awslabs/gluon-ts

GluonTS是一个用于概率时间序列建模的Python软件包,专注于基于深度学习的模型。不过目前非常多的模型都是基于MXNET实现的

GluonTS的特点如下:

  1. 使用MXNet和PyTorch实现的最先进模型;
  2. 通过Amazon SageMaker轻松实现AWS集成;
  3. 用于加载和迭代时间序列数据集的实用程序;
  4. 用于评估模型性能并比较其准确性的实用程序;
  5. 用于定义自定义模型和快速实验的构建块

07


pytorch-forcasting(1.9k+)

  • https://github.com/jdb78/pytorch-forecasting

pytorch Forecasting是一个基于pytorch的工具包,开发了很多最新的深度时间序列模型。它为pandas数据帧上的培训网络提供了一个高级API,并利用PyTorch Lightning在(多个)GPU、CPU上进行可扩展的培训,以及自动记录。

目前涉及的模型包括:

  • Temporal Fusion Transformers for Interpretable Multi-horizon Time Series Forecasting which outperforms DeepAR by Amazon by 36-69% in benchmarks
  • N-BEATS: Neural basis expansion analysis for interpretable time series forecasting which has (if used as ensemble) outperformed all other methods including ensembles of traditional statical methods in the M4 competition. The M4 competition is arguably the most important benchmark for univariate time series forecasting.
  • N-HiTS: Neural Hierarchical Interpolation for Time Series Forecasting which supports covariates and has consistently beaten N-BEATS. It is also particularly well-suited for long-horizon forecasting.
  • DeepAR: Probabilistic forecasting with autoregressive recurrent networks which is the one of the most popular forecasting algorithms and is often used as a baseline
  • Simple standard networks for baselining: LSTM and GRU networks as well as a MLP on the decoder
  • A baseline model that always predicts the latest known value

08


tsai(1.9k+)

  • https://github.com/timeseriesAI/tsai

tsai是在Pytorch&fastai基础上开发的开源深度学习软件包,专注于时间序列任务的最新技术,如分类、回归、预测等。

目前tsai仍然还在不断开发中,目前涵盖的模型包括:

  • LSTM (Hochreiter, 1997) (paper)
  • GRU (Cho, 2014) (paper)
  • MLP - Multilayer Perceptron (Wang, 2016) (paper)
  • gMLP - Gated Multilayer Perceptron (Liu, 2021) (paper)
  • FCN - Fully Convolutional Network (Wang, 2016) (paper)
  • ResNet - Residual Network (Wang, 2016) (paper)
  • LSTM-FCN (Karim, 2017) (paper)
  • GRU-FCN (Elsayed, 2018) (paper)
  • mWDN - Multilevel wavelet decomposition network (Wang, 2018) (paper)
  • TCN - Temporal Convolutional Network (Bai, 2018) (paper)
  • MLSTM-FCN - Multivariate LSTM-FCN (Karim, 2019) (paper)
  • InceptionTime (Fawaz, 2019) (paper)
  • Rocket (Dempster, 2019) (paper)
  • XceptionTime (Rahimian, 2019) (paper)
  • ResCNN - 1D-ResCNN (Zou , 2019) (paper)
  • TabModel - modified from fastai's TabularModel
  • OmniScale - Omni-Scale 1D-CNN (Tang, 2020) (paper)
  • TST - Time Series Transformer (Zerveas, 2020) (paper)
  • TabTransformer (Huang, 2020) (paper)
  • GatedTabTransformer (Cholakov, 2022) (paper)
  • MiniRocket (Dempster, 2021) (paper)
  • XCM - An Explainable Convolutional Neural Network (Fauvel, 2021) (paper)

09


Deep Learning TS(1.6k+)

  • https://github.com/Alro10/deep-learning-time-series

深度学习应用于实践序列大论文,代码以及相关的实验等,不过目前该Git的更新已经不是非常频繁了

10


Flow Forcast(1k+)

  • https://github.com/AIStream-Peelout/flow-forecast

流量预测(FF)是一个针对时间序列预测框架的开源深度学习。它提供了所有最先进的模型(变形金刚、注意力模型、GRU)和前沿概念,以及易于理解的可解释性指标、云提供商集成和模型服务功能。Flow Forecast是第一个支持基于transformer的模型的时间序列框架,也是唯一一个真正的时间序列预测框架的端到端深度学习。目前,CoronaWhy的任务TS主要维护该存储库。欢迎拉取请求。历史上,该存储库为山洪暴发和河流流量预测提供了开源基准和代码。

目前涵盖的模型包括:

  • Vanilla LSTM (LSTM): A basic LSTM that is suitable for multivariate time series forecasting and transfer learning.
  • Full transformer (SimpleTransformer in model_dict): The full original transformer with all 8 encoder and decoder blocks. Requires passing the target in at inference.
  • Simple Multi-Head Attention (MultiHeadSimple): A simple multi-head attention block and linear embedding layers. Suitable for transfer learning.
  • Transformer with a linear decoder (CustomTransformerDecoder in model_dict): A transformer with n-encoder blocks (this is tunable) and a linear decoder.
  • DA-RNN: (DARNN) A well rounded model with which utilizes a LSTM + attention.
  • Enhancing the Locality and Breaking the Memory Bottleneck of Transformer on Time Series Forecasting (called DecoderTransformer in model_dict):
  • Transformer XL: Porting Transformer XL for time series.
  • Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting (Informer)
  • DeepAR
  • DSANet

11


AtsPy(450)

AtsPy 代表Python 中的自动时间序列模型。该库的目标是预测单变量时间序列。

AtsPy的优势在于:

  • 通过AutomatedModel(df),以统一的方式实现所有您喜欢的自动化时间序列模型。
  • 通过使用LightGBM和TSFresh注入的功能,将结构模型错误减少30%-50%。
  • 使用奇异谱分析、周期图和峰值分析自动识别数据中的周期性。
  • 使用样本内验证方法确定并提供适合时间序列的最佳模型。
  • 将所有这些模型的预测结合在一个简单(平均)和复杂(GBM)集合中,以提高性能。
  • 已经开发了适当的模型,以使用GPU资源来加速自动化过程。
  • 可以使用am.models_dict_in处理样本哪数据。使用am.models_dict_out用于样本外预测。

目前涉及的模型有:

  • ARIMA - Automated ARIMA Modelling
  • Prophet - Modeling Multiple Seasonality With Linear or Non-linear Growth
  • HWAAS - Exponential Smoothing With Additive Trend and Additive Seasonality
  • HWAMS - Exponential Smoothing with Additive Trend and Multiplicative Seasonality
  • NBEATS - Neural basis expansion analysis (now fixed at 20 Epochs)
  • Gluonts - RNN-based Model (now fixed at 20 Epochs)
  • TATS - Seasonal and Trend no Box Cox
  • TBAT - Trend and Box Cox
  • TBATS1 - Trend, Seasonal (one), and Box Cox
  • TBATP1 - TBATS1 but Seasonal Inference is Hardcoded by Periodicity
  • TBATS2 - TBATS1 With Two Seasonal Periods

12


AutoTS(450+)

 

  • https://github.com/winedarksea/AutoTS

AutoTS是Python的一个时间序列包,旨在快速大规模部署高准确的预测。AutoTS中的所有模型都支持预测多变量(多时间序列)输出,也支持概率(上下届)预测。大多数模型可以很容易地扩展到数十甚至数十万个输入序列。许多模型还支持传入用户定义的外生的回归。

参考文献

  1. TSFresh Document
  2. https://github.com/blue-yonder/tsfresh/
  3. https://github.com/winedarksea/AutoTS
  4. https://github.com/unit8co/darts
  5. https://github.com/facebookresearch/Kats
  6. https://github.com/alan-turing-institute/sktime
  7. https://www.sktime.org/en/stable/estimator_overview.html
  8. 时间序列预测的 7 种 Python 工具包,总有一款适合你!
  9. https://github.com/awslabs/gluon-ts
  10. https://github.com/Alro10/deep-learning-time-series
  11. https://github.com/timeseriesAI/tsai
  12. https://github.com/jdb78/pytorch-forecasting
  13. https://github.com/AIStream-Peelout/flow-forecast
   
     
        
            
               
往期精彩回顾




  • 交流群

欢迎加入机器学习爱好者微信群一起和同行交流,目前有机器学习交流群、博士群、博士申报交流、CV、NLP等微信群,请扫描下面的微信号加群,备注:”昵称-学校/公司-研究方向“,例如:”张小明-浙大-CV“。请按照格式备注,否则不予通过。添加成功后会根据研究方向邀请进入相关微信群。请勿在群内发送广告,否则会请出群,谢谢理解~(也可以加入机器学习交流qq群772479961


      
         

浏览 122
点赞
评论
收藏
分享

手机扫一扫分享

分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

分享
举报