liveBook · Manning

M3 dataset

As explained in Time Series Forecasting Using Foundation Models

The M3 dataset is a collection of 3,003 time series from the M3 forecasting competition sampled at yearly, quarterly, and monthly frequencies.

The M3 dataset contains 3,003 time series from the M3 forecasting competition, sampled yearly, quarterly, and monthly. Its series span marketing, macroeconomics, microeconomics, and demographics, while their specific origins remain anonymized. A monthly subset contains 1,428 series identified from M1 through M1428. section 2.3

Use the dataset for:

  • Loading monthly series with the datasetsforecast M3 loader and converting ds values to datetime. section 2.3
  • Plotting individual series by unique_id to inspect visible trends and seasonality. section 2.3
  • Pretraining N-BEATS with 24 months of input to predict a 12-month monthly horizon. section 2.4
Listing 2.1 Importing libraries and loading the dataset
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

from datasetsforecast.m3 import M3

import warnings
warnings.filterwarnings('ignore')
Y_df, *_ = M3.load(directory='../data/',
➥ group='Monthly')  #1
Y_df['ds'] = pd.to_datetime(Y_df['ds'])

Y_df.head()

Load the monthly M3 data with pandas, NumPy, Matplotlib, and datasetsforecast, then inspect the resulting dataframe. section 2.3

How Time Series Forecasting Using Foundation Models covers it

How deep it goes
Defines the dataset, inspects monthly series, and configures model input without detailing the competition’s original data collection.
Examples
Uses monthly series M1 through M1428, plots the first four, and trains N-BEATS on a 12-month horizon.
What you can do after
Operate the datasetsforecast loader and prepare monthly series for N-BEATS pretraining.
How it connects
Connects time-series forecasting with pretraining, transfer learning, foundation models, and N-BEATS.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Time Series Forecasting Using Foundation Models. The section links point to the parts of the book it draws on.