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
