Course contentsShow
← Machine Learning and Deep Learning
Lesson 2412 of 3,53852. Time Series and ForecastingFree lesson

Sequence-to-Sequence Forecasting

Build encoder-decoder models to forecast multiple future timesteps from historical sequences.

Sequence-to-Sequence Forecasting

What you'll learn: How to use encoder-decoder architectures to predict multiple future timesteps from a historical sequence in one forward pass.

The Core Idea

Until now, you've likely built models that predict one future value at a time (like "what's tomorrow's temperature?"). Sequence-to-sequence (seq2seq) forecasting takes an entire historical sequence as input and outputs an entire sequence of future predictions — say, the next 7 days all at once.

Think of it like translating a sentence from English to French: the encoder reads the whole English sentence and compresses its meaning into a context vector, then the decoder unfolds that context into the French translation. Here, your encoder reads historical timesteps (past 30 days), and your decoder generates future timesteps (next 7 days).

Architecture

The encoder (typically an LSTM or GRU) processes your input sequence step-by-step, building up hidden states that capture temporal patterns. The final hidden state becomes your context vector — a compressed representation of what happened historically.

The decoder (another LSTM/GRU) starts from this context and generates predictions autoregressively: it predicts timestep t+1, feeds that prediction back in, then predicts t+2, and so on until you've forecasted your entire horizon.

Why This Matters

Seq2seq models excel when:

  • You need multi-step forecasts with interdependencies between predicted steps
  • Future values depend on complex patterns in the entire history, not just recent lags
  • You want to capture the sequential structure of both input and output

They're especially powerful when the forecast horizon is long or when autoregressive errors (predictions feeding into predictions) need careful handling.

Key Takeaway: Sequence-to-sequence models use encoder-decoder architectures to map entire historical sequences to entire future forecast sequences, enabling sophisticated multi-horizon predictions in a single model.