1 Star 0 Fork 2

Nichanghao / Time-Series-Analysis-Tutorial

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

时间序列分析——分类与预测教程

作者:datamonday

贡献者:datamonday

Github:https://github.com/datamonday/Time-Series-Forecasting-Algorithm

CSDN:原理+论文+实战:60篇由浅入深的时间序列预测/分类教程汇总

初次发布:2020-04-17

最后修改:2021-04-06


[toc]


前言

⏱最一段时间都在学习时间序列预测和时间序列分类相关的知识,一开始感觉无从下手,论文看不懂,代码不会写。经过近三个月的摸索,也算是入门的小白了,这篇博文算是个人经过踩坑,去粗取精之后的经验总结。通过4篇博客、9篇论文、32篇实战教程,梳理出了一套系统化的时间序列预测和时间序列分类任务的入门指南。文中提及的博客论文和教程全部内容字数大约在50万字到100万字之间。既是对这段时间所学知识的梳理总结,也希望给有需要的同学提供帮助。水平有限,如有问题欢迎指出,谢谢。


🎯【适用人群】:

  • 没有时间序列预测/分类相关的经验的小白

⌨【代码环境】:

  • python 3.7.6
  • tensorflow 2.1.0

🔊【注意事项】:

  • 因为tensorflow 2.0版本开始集成了keras,成为了 tensorflow.keras API,因此不用额外安装,并且无需 import keras

  • 本文提及文章的神经网络编写部分使用Keras深度学习框架。

  • 本文提及文章的所有代码均在Jupyter Notebook中编写,并测试通过。

  • 本文提及的所有文章中,参考资料均在每篇文章的文末给出。


📽【行文顺序】:

  • 原理篇:逻辑顺序

  • 论文篇:时间顺序

  • 实战篇:逻辑顺序+时间顺序

  • 注:本文提及的网络架构、论文、教程都是按照由浅入深介绍的,教程部分(三、实战篇)有些教程是有相互关联的。


📖【主要内容】:时间序列任务分为时间序列预测时间序列分类两种类型,本文主要内容如下:

  • LSTM 及其不同的网络架构处理时间序列预测/分类任务;
  • CNN 及其不同的网络架构处理时间序列预测/分类任务;
  • CNN-LSTM 网络处理时间序列预测/分类任务;
  • ConvLSTM 网络处理时间序列预测/分类任务;
  • DeepConvLSTM 网络处理时间序列分类任务;
  • LSTM-FCN 网络处理时间序列分类任务;
  • Multivariate LSTM-FCNs 网络处理时间序列分类任务

一、原理篇

本部分所有标题都设置了对应文章超链接,直接点击传送。

如果对下文提及的原理比较熟悉,可以直接跳过。


1.1 CNN

1. 零基础入门深度学习(4) - 卷积神经网络

  • 文章日期:2017/08/28
  • 内容梗概:CNN算法原理+数学推导+代码实现

1.2 RNN

2. 零基础入门深度学习(5) - 循环神经网络

  • 文章日期:2017/08/28
  • 内容梗概:RNN算法原理+数学推导+代码实现

1.3 LSTM

3. Understanding LSTM Networks

  • 文章日期:2015/08/27
  • 适合人群:了解LSTM的基本原理。

相信大家看过的很多介绍LSTM原理的文章都用到了这篇文章的配图。


4. 零基础入门深度学习(6) - 长短时记忆网络(LSTM)

  • 文章日期:2017/08/28
  • 内容梗概:LSTM算法原理+数学推导+代码实现

这三篇文章(本篇+之前同系列两篇)应该是我目前遇到的讲解得最详细最全面思路最清晰的文章,由浅入深,原理+推导+代码,墙裂推荐。


二、论文篇

本部分主要内容:

  • 时间序列分类任务数据集构建(人类活动识别)
  • CNN-LSTM 网络
  • ConvLSTM 网络
  • DeepConvLSTM 网络
  • LSTM-FCN 网络

本部分可以先跳过,直接看实战篇,如果对其中的网络架构有疑问或者有些内容看不懂,再阅读这些论文也可以。


2.1 WISDM 实验室论文

1. Activity Recognition using Cell Phone Accelerometers

  • 论文被引:2034
  • 论文年份:2010

WISDM实验室应该是最早开始做基于手机传感器的人类活动识别的实验室,手机的数据只有3个特征(3轴传感器数据)。这篇论文是该实验室的第一篇论文,主要介绍了关于数据集的构建与处理


2. Cell Phone-Based Biometric Identification

  • 论文被引:262
  • 论文年份:2010

这篇论文是该实验室的第二篇论文,主要介绍了 数据收集以及将时间序列数据转换为样本的过程,值得借鉴。

该实验室还有3篇论文,个人感觉参考意义不大,可以先不看。


2.2 UCI-HAR 数据集论文

1. Human Activity Recognition on Smartphones using a Multiclass Hardware-Friendly SVM

  • 论文被引:619
  • 论文年份:2012

这篇论文是创建该数据集的实验室发表的有关人类活动识别的第一篇论文,主要介绍了使用监督机器学习方法通过手机传感器信号来识别人类活动(6类,分别是站立,行走,放置,行走,上楼和在下楼)进行分类。使用9个特征(6轴传感器+3个分离信号(身体重力加速度))。


2. A Public Domain Dataset for Human Activity Recognition Using Smartphones

  • 论文被引:763
  • 论文年份:2013

这篇论文介绍了 UCI-HAR Dataset数据集是如何创建的,很有借鉴意义,如果做时间序列分类任务的话,是必读论文


2.3 CNN-LSTM 论文

1. Long-term Recurrent Convolutional Networks for Visual Recognition and Description

  • 论文被引:3634
  • 论文年份:2015

该论文提出的网络架构最初被称为长期循环卷积网络(LRCN),现在使用“CNN LSTM”来指代使用CNN作为前端的LSTM。该网络架构最初用于生成图像的文本描述的任务。关键是CNN,该CNN在图像分类任务上进行了预训练,使得可以用作字幕生成的特征提取器。


2. Show and Tell: A Neural Image Caption Generator

  • 论文被引:3378
  • 论文年份:2015

该论文提出的网络架构用于语音识别和自然语言处理问题,其中CNN用作音频和文本输入数据上的特征提取器,之后输入到LSTM进行进一步处理。

这两篇论文是CNN-LSTM网络家族的开篇之作,是必读论文。


2.4 ConvLSTM 论文

1. Convolutional LSTM Network: A Machine Learning Approach for Precipitation Nowcasting

  • 论文被引:1787
  • 论文年份:2015

这篇论文是最先提出 ConvLSTM 网络架构的论文,该论文是用于预测相对短时间内某个地区未来的降雨强度,属于必读论文。


2.5 DeepConvLSTM 论文

1. Deep Convolutional Neural Networks On Multichannel Time Series For Human Activity Recognition

  • 论文被引:541
  • 论文年份:2015

在基准数据集上对所提方法与现有方法的比较进行了广泛的研究。结果表明,该方法是一种很有竞争力的HAR问题求解算法。该论文还研究了CNN的效率,并得出结论:CNN对于在线人类活动识别是足够快的


2. Deep Convolutional and LSTM RNN for Multimodal Wearable Activity Recognition

  • 论文被引:836
  • 论文年份:2016

该论文提出了DeepConvLSTM网络架构:由卷积层和LSTM循环层组成的深度学习框架,它能够自动学习特征表示并对它们的激活之间的时间依赖性进行建模。通过业内的标准的人类活动识别数据集(OPPORTUNITY和Skoda)进行实验,证明此框架适用于可穿戴传感器数据的活动识别。属于必读论文。


2.6 LSTM-FCN 论文

1. LSTM Fully Convolutional Networks for Time Series Classification

  • 论文被引:211
  • 论文年份:2017

该论文提出的模型在显著地提高全卷积网络性能的同时保证模型大小只有很少的增加,并且几乎不需要对数据集进行预处理。提出的长短期记忆-全卷积网络 (LSTM-FCN) 与其他网络相比,具有最新的性能。利用注意力-长短期记忆-全卷积网络 (ALSTM-FCN),探讨了注意力机制在时间序列分类中的应用。利用注意力机制可以可视化LSTM细胞的决策过程。此外,还提出了微调的方法来提高训练模型的性能。对模型的性能进行了全面的分析,并与其他技术进行了比较。


2. Multivariate LSTM-FCNs for Time Series Classification

  • 论文被引:70
  • 论文年份:2018

该论文提出将现有的单变量时间序列分类模型长短期记忆-全卷积网络(LSTM-FCN)和注意力-长短期记忆-全卷积网络(ALSTM-FCN)通过在全卷积块上增加一个压缩和激励块来进一步提高分类精度,从而转化为多变量时间序列分类模型。提出的模型在少量预处理的情况下优于大多数最新模型。所提出的模型能有效地处理各种复杂的多元时间序列分类任务,如活动识别或动作识别。此外,所提出的模型在满足实时要求(小,快),可以部署在内存受限的系统上。


三、实战篇

3.1 时间序列任务 入门篇

本部分不涉及具体的数据集,使用构造的数字序列;目的是通过程序了解网络架构和定义方法。



3.2 时间序列预测 基础篇


3.3 时间序列预测 进阶篇



3.3 时间序列分类 基础篇


3.4 时间序列分类 进阶篇 (⏳ 更新中···)


四. 调参篇


五. 相关论文(⏳ 更新中···)

  1. Energy consumption prediction using machine learning a review
  2. Electric Energy Consumption Prediction by Deep Learning with State Explainable Autoencoder
  3. Diffusion Convolutional Recurrent Neural Network: Data-Driven Traffic Forecasting
  4. 【CMU & AWS 2020】Forecasting Big Time Series: Theory and Practice(Part I)
  5. 【CMU & AWS 2020】Forecasting Big Time Series: Theory and Practice(Part II)
  6. A review of data-driven building energy consumption prediction studies
  7. A Comparative Study of Time Series Forecasting Methods for Short T erm Electric Energy Consumption Prediction in Smart Buildings

六. 注意力机制(2020/10/29更新)

  1. Attention Is All You Need(Transformer)
  2. 【Attention】注意力机制简介
  3. 【Attention】注意力机制的直观理解
  4. 【Attention】图解 Attention
  5. 【Attention】注意力机制概述
  6. 【Transformer】How Transformers Work
  7. 【Transformer】图解 Transformer

源码获取(2021)

Github:https://github.com/datamonday/Time-Series-Forecasting-Algorithm

部分源码已经放到Github了,欢迎Star,Fork!


公众号

欢迎关注公众号,获取更多干货内容! 在这里插入图片描述


以上是三个多月以来对时间序列预测和分类任务的总结,仅供参考。如果给你带来了帮助,请动动手指点个赞;如果对文中内容存疑,欢迎指出交流,谢谢各位人才。

刚开始的时候,无从下手,走了很多弯路。经过这段时间的试错和摸索,算是总结出了一些经验。上文提到的论文,是个人认为帮助比较大的论文,如果在做时间序列预测或分类任务的话最好看一下,理解其中的建模思路和网络架构的优缺点,以便快速上手。

实战篇的代码主要参考澳大利亚博主Jason Brownlee的博客文章,在此表示感谢。博客地址:传送门


Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

时间序列分析教程 展开 收起
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/ni-changhao/Time-Series-Analysis-Tutorial.git
git@gitee.com:ni-changhao/Time-Series-Analysis-Tutorial.git
ni-changhao
Time-Series-Analysis-Tutorial
Time-Series-Analysis-Tutorial
beta

搜索帮助

53164aa7 5694891 3bd8fe86 5694891