Deep Neural Networks for Time Series Forecasting

Created by Dr. Pedram Jahangiry | Enhanced with Claude

Set the controls below, then click Train Model to train an actual feedforward neural network in your browser on the classic 1949–1960 airline-passenger counts, using your chosen number of lagged months as inputs. Watch the loss curve, the network diagram, and the forecast update after each run, and compare its error metrics against a simple linear-regression benchmark.

Understanding Deep Neural Networks for Time Series

This visualization demonstrates how Deep Neural Networks (DNNs) learn patterns in time series data using the classic airline passenger dataset (1949-1960). DNNs use multiple layers of neurons to capture complex nonlinear relationships between lagged values and future predictions.

Key Concept: Unlike linear models, DNNs can learn nonlinear transformations through activation functions (ReLU, tanh). Each hidden layer learns increasingly abstract features. The model is trained using backpropagation with the Adam optimizer to minimize Mean Squared Error (MSE).

Scaling: The network trains on min–max scaled counts. Raw counts in the hundreds saturate tanh units and can switch ReLU units off for good, which shows up as a flat prediction line. The scaler is fitted on the training months only, so the training data lie between 0 and 1, while the test months, which climb past the training peak, land a little above 1. Predictions are converted back to passengers before any error is computed, so every metric and chart on this page is in passengers.

Benchmark: We compare DNN performance against Linear Regression to understand when the added complexity provides value.

Model Configuration

2
12
200

Neurons per Layer

Training Loss Curve
Model Architecture
Feature Importance (First Layer Weights)
Time Series: Actual vs Predicted Passengers

When Do DNNs Outperform Linear Models for Time Series?