Deep Forecasting Models
Neural networks purpose-built for forecasting, capable of ingesting massive datasets, finding complex non-linear patterns, and predicting multiple future steps simultaneously.
Why Does This Exist?
Classical models like ARIMA fit exactly one model to exactly one time series. If a retail company wants to forecast sales for 100,000 different products, they have to train and deploy 100,000 separate ARIMA models. This is computationally exhausting.
Deep Forecasting Models (using neural networks) solve this by learning globally. You train one single neural network on all 100,000 products simultaneously. Because it sees everything, the network learns global rules (e.g., "when a product drops in price by 10%, sales usually spike").
Furthermore, neural networks natively support multi-step horizons. Instead of just predicting tomorrow, they can output a 30-day forecast all at once.
Think of It Like This
Think of It Like This
Imagine predicting the final score of a basketball game.
A classical model looks exclusively at the historical scores of the Lakers. It doesn't care about any other team.
A deep forecasting model watches historical footage of every single team in the league. Because it watches everyone, it learns general principles: "teams playing back-to-back nights score fewer points" or "teams with injured stars struggle". It applies these global rules to predict the Lakers' score much more accurately than looking at the Lakers in isolation.
How It Actually Works
Over the last few years, three distinct architectures have dominated deep time series forecasting.
1. RNNs and LSTMs (The Legacy Approach)
Long Short-Term Memory (LSTM) networks process data sequentially. They read Day 1, update their hidden "memory" state, read Day 2, update memory, and so on.
- Pros: Naturally handles variable-length sequences.
- Cons: Cannot remember very long-term patterns, and very slow to train because they must process data sequentially, preventing parallelization on GPUs.
2. N-BEATS (The Pure MLP Approach)
Developed in 2019, N-BEATS proved that you don't need complex RNNs to forecast time series. It uses a massive stack of simple Multi-Layer Perceptrons (standard fully connected layers) combined with backward and forward residual links.
- Pros: Highly interpretable. The network is explicitly forced to decompose the signal into "Trend" and "Seasonality" blocks, mimicking Classical Decomposition.
3. Temporal Fusion Transformer (TFT)
TFT is arguably the most robust architecture used in enterprise forecasting today. It uses the Attention Mechanism to process time series, but it solves a critical problem: integrating static metadata.
- Pros: It easily handles Static Variables (e.g., the store location, the product category) and combines them with Time-Varying Variables (e.g., the daily price, the day of the week) to produce highly accurate, explainable forecasts.
The Global vs Local Tradeoff
Watch Out For
Deep Learning is terrible for small data. If you only have one single time series with 500 data points (e.g., the daily closing price of one stock for two years), a deep neural network will aggressively overfit the noise and perform far worse than a simple ARIMA or Exponential Smoothing model. Deep forecasters only unlock their power when trained globally across thousands of related time series.
Show Me the Code
Training these models from scratch in PyTorch is notoriously difficult due to complex data windowing. Instead, practitioners use Darts or PyTorch Forecasting.
# Using the Darts library (pip install darts)from darts import TimeSeriesfrom darts.models import NBEATSModelimport pandas as pd
# Assume df has 1,000 days of sales datadf = pd.read_csv("sales.csv")series = TimeSeries.from_dataframe(df, "date", "sales")
# Initialize N-BEATS# input_chunk_length = how far back to look (e.g., 30 days)# output_chunk_length = how far forward to predict (e.g., 7 days)model = NBEATSModel( input_chunk_length=30, output_chunk_length=7, n_epochs=100)
# Train the modelmodel.fit(series)
# Forecast the next 7 days in one shotforecast = model.predict(n=7)forecast.plot()The Quick Version
- Deep forecasting models use neural networks to predict time series.
- They are trained globally (one model for thousands of time series), allowing them to learn cross-series patterns.
- They predict multi-step horizons instantly, unlike classical models which step forward one day at a time.
- Prominent architectures include LSTMs (older), N-BEATS (interpretable MLPs), and Temporal Fusion Transformers (handles complex metadata).
- They require massive amounts of data; for small datasets, classical models are still vastly superior.