Every control below retrains 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).
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 Set Performance
DNN MSE:-
DNN RMSE:-
DNN MAE:-
LR MSE:-
LR RMSE:-
LR MAE:-
Test Set Performance
DNN MSE:-
DNN RMSE:-
DNN MAE:-
LR MSE:-
LR RMSE:-
LR MAE:-
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?
Nonlinear Patterns: DNNs excel when relationships between lags and future values are nonlinear (e.g., exponential growth, complex seasonality)
Feature Interactions: Hidden layers can learn interactions between different lag features automatically
Sufficient Data: DNNs need more training data than linear models to avoid overfitting
Overfitting Risk: Too many layers/neurons can lead to memorizing training data rather than learning generalizable patterns
Activation Functions: ReLU enables learning of piecewise linear functions; Tanh provides smooth nonlinearities; Linear activation means no transformation (useful for comparison)
Training Duration: More epochs allow the model to learn better but may lead to overfitting if too many
Interpretability Trade-off: While DNNs may provide better predictions, they are less interpretable than linear models or traditional time series methods like ARIMA