Modern Time Series Analysis and Sequence Learning

Classical Theory, Forecasting, Spectral Methods, Deep Learning, and AI-Assisted Modeling

Author

He Wang

Published

June 20, 2026

1 Modern Time Series Analysis and Sequence Learning

MATH 7339: Machine Learning and Statistical Learning Theory 2

This interactive e-book is the time-series analysis and sequence-data part of an advanced machine learning theory sequence for students in the MS Applied Mathematics program. It combines rigorous mathematical modeling with computational labs, interactive HTML demonstrations, and responsible AI-assisted workflows.

Author: He Wang
GitHub repository: https://github.com/wanghemath/Book-MachineLearning2sda
Book website: https://wanghemath.github.io/Book-MachineLearning2sda/

1.1 What this book covers

Time series and sequence data are not ordinary tabular data. The order of the observations matters, dependence across time matters, and the information available at the forecast origin must be respected. This book develops both the classical theory and modern machine learning tools needed for forecasting, filtering, representation learning, and sequence modeling.

The book begins with stochastic-process notation, exploratory analysis, stationarity, autocovariance, ARMA/ARIMA/SARIMA models, forecasting theory, and diagnostics. It then moves to state-space models, hidden Markov models, spectral analysis, FFT, filtering, wavelets, automated forecasting, feature-based machine learning, probabilistic forecasting, neural networks, convolutional sequence models, RNN/LSTM/GRU models, attention, transformers, representation learning, multivariate forecasting, AI-assisted modeling, and final projects.

1.2 How to use this book

Each chapter follows a consistent structure:

  1. A motivating example.
  2. Mathematical model and core theory.
  3. Interactive HTML demonstration.
  4. Python examples.
  5. Python lab opened directly in Google Colab.
  6. AI-assisted modeling or study activity.
  7. Common mistakes, exercises, mini project, and checklist.
NoteInteractive modules

The interactive demonstrations are designed for the HTML version of the book. Plotly.js is loaded once globally through assets/header.html; do not add additional Plotly script tags inside individual chapter files.

TipPython labs in Google Colab

Each lab notebook can be opened from GitHub directly in Google Colab using the links below. After the book is pushed to the repository, the Colab links will point to the notebooks in labs/ on the main branch.

1.3 Chapter map and Colab labs

1.3.1 Part I. Time Series as Dependent Data

Ch. Topic Chapter Python lab
1 Why Time Series and Sequence Data Are Different Read Open in Colab
2 Exploratory Data Analysis for Time Series Read Open in Colab

1.3.2 Part II. Stationarity and Linear Time-Domain Models

Ch. Topic Chapter Python lab
3 Stationarity, Autocovariance, and Autocorrelation Read Open in Colab
4 Linear Processes, AR, MA, and ARMA Models Read Open in Colab
5 Difference Equations and Dynamic Behavior Read Open in Colab
6 Forecasting Theory and Best Linear Prediction Read Open in Colab
7 Estimation, Model Identification, and Diagnostics Read Open in Colab

1.3.3 Part III. Nonstationary and Seasonal Models

Ch. Topic Chapter Python lab
8 ARIMA Models and Differencing Read Open in Colab
9 Seasonal ARIMA and Multiple Seasonality Read Open in Colab
10 State-Space Models and Kalman Filtering Read Open in Colab
11 Hidden Markov Models and Regime Switching Read Open in Colab

1.3.4 Part IV. Frequency-Domain and Multiresolution Methods

Ch. Topic Chapter Python lab
12 Spectral Analysis and the Frequency Domain Read Open in Colab
13 Discrete Fourier Transform, FFT, and the Periodogram Read Open in Colab
14 Filtering and Wavelet Transform Read Open in Colab

1.3.5 Part V. Forecasting at Scale and Machine Learning Methods

Ch. Topic Chapter Python lab
15 Forecast Evaluation and Backtesting Read Open in Colab
16 Automated Forecasting and Prophet-Type Additive Models Read Open in Colab
17 Feature-Based Machine Learning for Time Series Read Open in Colab
18 Probabilistic Forecasting and Uncertainty Quantification Read Open in Colab

1.3.6 Part VI. Deep Learning for Time Series and Sequence Data

Ch. Topic Chapter Python lab
19 Neural Networks for Time Series Read Open in Colab
20 Convolutional Models for Sequences Read Open in Colab
21 Recurrent Neural Networks, LSTM, and GRU Read Open in Colab
22 Attention and Transformer Models for Time Series and Sequence Data Read Open in Colab
23 Representation Learning for Time Series Read Open in Colab
24 Multivariate, Panel, and Hierarchical Time Series Read Open in Colab

1.3.7 Part VII. Responsible AI, Projects, and Deployment

Ch. Topic Chapter Python lab
25 AI-Assisted Time-Series Modeling Read Open in Colab
26 End-to-End Forecasting Pipeline Read Open in Colab
27 Final Project Studio Read Open in Colab

1.5 Computing environment

The notebooks are intended to run in Google Colab with standard scientific Python packages. Some later chapters use statsmodels, scikit-learn, and torch. When a package is missing in Colab, install it in the first notebook cell, for example:

Code
# Example only: run inside Colab when needed
# !pip install statsmodels scikit-learn torch

1.6 Responsible AI policy for the course

AI tools may be used for brainstorming, code review, debugging, and explanation. They should not replace mathematical reasoning, residual diagnostics, validation design, or interpretation of results. A correct forecasting workflow must clearly state the information set, prevent look-ahead leakage, compare against baselines, evaluate using chronological validation, and report uncertainty when decisions depend on risk.

1.7 Repository structure

Book-MachineLearning2sda/
├── _quarto.yml
├── index.qmd
├── introduction.qmd
├── chapters/
│   ├── chapter-01-why-time-series-and-sequences.qmd
│   └── ...
├── labs/
│   ├── chapter-01-why-time-series-and-sequences-lab.ipynb
│   └── ...
├── assets/
│   ├── header.html
│   ├── ts-interactives.js
│   └── custom.scss
└── references.bib

1.8 Build locally

After cloning the repository, render the book with:

quarto render
quarto preview

The HTML output is written to docs/, which is suitable for GitHub Pages when the repository is configured to publish from the docs/ folder.