liveBook · Manning

What you will learn in Time Series Forecasting Using Foundation Models

How to build high accuracy predictive models

by Marco Peixeiro

Chapter by chapter

Chapter 1: Understanding foundation models

1.1 Defining a foundation model · 1.2 Exploring the transformer architecture · 1.2.1 Feeding the encoder · 1.2.2 Inside the encoder · 1.2.3 Making predictions · 1.3 Advantages and disadvantages of foundation models · 1.3.1 Benefits of foundation forecasting models · 1.3.2 Drawbacks of foundation forecasting models · 1.4 Next steps · 1.5 Summary

What you learn in chapter 1 →

Chapter 2: Building a foundation model

2.1 Exploring the architecture of N-BEATS · 2.1.1 Basis expansion · 2.2 Architecture of N-BEATS · 2.2.1 A block in N-BEATS · 2.2.2 A stack in N-BEATS · 2.2.3 Assembling N-BEATS · 2.3 Pretraining our model · 2.4 Pretraining N-BEATS · 2.5 Transfer learning with our pretrained model · 2.6 Fine-tuning our pretrained model · 2.7 Evaluating each approach · 2.8 Forecasting at another frequency · 2.9 Understanding the challenges of building a foundation model · 2.10 Next steps · 2.11 Summary

What you learn in chapter 2 →

Chapter 3: Forecasting with TimeGPT

3.1 Defining generative pretrained transformers · 3.2 Exploring TimeGPT · 3.2.1 Training TimeGPT · 3.2.2 Quantifying uncertainty in TimeGPT · 3.3 Forecasting with TimeGPT · 3.3.1 Initial setup · 3.3.2 Zero-shot forecasting · 3.3.3 Performance evaluation · 3.4 Fine-tuning with TimeGPT · 3.4.1 Fine-tuning TimeGPT · 3.4.2 Evaluating the fine-tuned model · 3.4.3 Controlling the depth of fine-tuning · 3.5 Forecasting with exogenous variables · 3.5.1 Preparing the exogenous features · 3.5.2 Forecasting with exogenous variables · 3.5.3 Explaining the effect of exogenous features with Shapley values · 3.5.4 Evaluating forecasts with exogenous features · 3.6 Cross-validating with TimeGPT · 3.7 Forecasting on a long horizon with TimeGPT · 3.8 Detecting anomalies with TimeGPT · 3.8.1 Detecting anomalies · 3.8.2 Evaluating anomaly detection · 3.9 Next steps · 3.10 Summary

What you learn in chapter 3 →

Chapter 4: Zero-shot probabilistic forecasting with Lag-Llama

4.1 Exploring Lag-Llama · 4.1.1 Viewing the architecture of Lag-Llama · 4.1.2 Pretraining Lag-Llama · 4.2 Forecasting with Lag-Llama · 4.2.1 Setting up Lag-Llama · 4.2.2 Zero-shot forecasting with Lag-Llama · 4.2.3 Changing the context length in Lag-Llama · 4.3 Fine-tuning Lag-Llama · 4.3.1 Handling initial setup · 4.3.2 Reading and splitting the data in Colab · 4.3.3 Launching the fine-tuning procedure · 4.3.4 Forecasting with a fine-tuned model · 4.3.5 Evaluating the fine-tuned model · 4.4 Model comparison table · 4.5 Next steps · 4.6 Summary

What you learn in chapter 4 →

Chapter 5: Learning the language of time with Chronos

5.1 Discovering the T5 family · 5.2 Exploring Chronos · 5.3 Using tokenization in Chronos · 5.4 Training a model with Chronos · 5.4.1 Tackling data scarcity with augmentation techniques · 5.4.2 Examining the pretrained Chronos models · 5.4.3 Selecting the appropriate Chronos model · 5.5 Forecasting with Chronos · 5.5.1 Initial setup · 5.5.2 Predictions · 5.6 Cross-validating with Chronos · 5.6.1 Running cross-validation · 5.6.2 Evaluating Chronos · 5.7 Fine-tuning Chronos · 5.7.1 Performing initial setup · 5.7.2 Configuring the fine-tuning parameters · 5.7.3 Launching the fine-tuning procedure · 5.7.4 Forecasting with a fine-tuned model · 5.7.5 Evaluating the fine-tuned model · 5.8 Detecting anomalies with Chronos · 5.9 Next steps · 5.10 Summary

What you learn in chapter 5 →

Chapter 6: Moirai: A universal forecasting transformer

6.1 Exploring Moirai · 6.1.1 Viewing the architecture of Moirai · 6.1.2 Pretraining Moirai · 6.1.3 Selecting the appropriate model · 6.2 Discovering Moirai-MoE · 6.2.1 Patching and embedding · 6.2.2 Studying the decoder-only transformer · 6.2.3 Pretraining Moirai-MoE · 6.3 Forecasting with Moirai · 6.3.1 Zero-shot forecasting with Moirai · 6.3.2 Cross-validation with Moirai · 6.3.3 Forecasting with exogenous features · 6.4 Detecting anomalies with Moirai · 6.5 Next steps · 6.6 Summary

What you learn in chapter 6 →

Chapter 7: Deterministic forecasting with TimesFM

7.1 Examining TimesFM · 7.1.1 Architecture of TimesFM · 7.1.2 Pretraining TimesFM · 7.2 Forecasting with TimesFM · 7.2.1 Zero-shot forecasting with TimesFM · 7.2.2 Cross-validation with TimesFM · 7.2.3 Forecasting with exogenous features · 7.3 Fine-tuning TimesFM and anomaly detection · 7.4 Next steps · 7.5 Summary

What you learn in chapter 7 →

Chapter 8: Forecasting as a language task

8.1 Overview of LLMs and prompting techniques · 8.1.1 Exploring Flan-T5 and Llama-3.2 · 8.1.2 Understanding the basics of prompting · 8.2 Forecasting with Flan-T5 · 8.2.1 Function to forecast with Flan-T5 · 8.2.2 Forecast with Flan-T5 · 8.3 Cross-validation with Flan-T5 · 8.3.1 Running cross-validation · 8.3.2 Evaluating Flan-T5 · 8.4 Forecasting with exogenous features with Flan-T5 · 8.4.1 Including exogenous features with Flan-T5 · 8.4.2 Extracting future values of exogenous variables · 8.4.3 Cross-validating with external features · 8.4.4 Evaluating Flan-T5 forecasts with exogenous features · 8.5 Detecting anomalies with Flan-T5 · 8.5.1 Defining a function for anomaly detection with Flan-T5 · 8.5.2 Running anomaly detection · 8.6 Forecasting with Llama-3.2 · 8.6.1 Performing initial setup · 8.6.2 Creating a function to forecast via API call · 8.6.3 Making predictions · 8.7 Cross-validating with Llama-3.2 · 8.8 Detecting anomalies with Llama-3.2 · 8.8.1 Modifying the system prompt · 8.8.2 Defining a function for anomaly detection · 8.8.3 Running anomaly detection with Llama-3.2 · 8.8.4 Evaluating anomaly detection · 8.9 Next steps · 8.10 Summary

What you learn in chapter 8 →

Chapter 9: Reprogramming an LLM for forecasting

9.1 Discovering Time-LLM · 9.1.1 Patch reprogramming · 9.1.2 Discovering Prompt-as-Prefix · 9.1.3 Making predictions · 9.2 Forecasting with Time-LLM · 9.2.1 Performing initial setup · 9.2.2 Generating forecasts · 9.3 Cross-validating with Time-LLM · 9.4 Evaluating Time-LLM · 9.5 Detecting anomalies with Time-LLM · 9.5.1 Detecting anomalies · 9.5.2 Evaluating anomaly detection · 9.6 Next steps · 9.7 Summary

What you learn in chapter 9 →

Chapter 10: Capstone project: Forecasting daily visits to a blog

10.1 Introducing the use case · 10.2 Walking through the project · 10.2.1 Setting the constants · 10.2.2 Forecasting with a seasonal naïve model · 10.2.3 Forecasting with ARIMA · 10.2.4 Forecasting with TimeGPT · 10.2.5 Forecasting with Chronos · 10.2.6 Forecasting with Moirai · 10.2.7 Forecasting with TimesFM · 10.2.8 Forecasting with Time-LLM · 10.2.9 Evaluating all models · 10.3 Staying up to date

What you learn in chapter 10 →

Concepts explained in this book

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.