Skip to content
← Back to Work

LSTM vs GRU — Time-Series Forecasting

A reproducible deep-learning experiment comparing LSTM and GRU recurrent neural networks for daily temperature time-series forecasting, with modular training, evaluation, testing, and documented results.

LivePython · TensorFlow · Keras · NumPy · Pandas · scikit-learn · Matplotlib · pytest · GitHub Actions

Problem

Sequential forecasting requires models that can learn temporal dependencies from previous observations. This project examines how two gated recurrent architectures—LSTM and GRU—perform on the same univariate temperature-forecasting task under a common experimental setup.

Approach

The project transforms daily temperature observations into 10-day lookback sequences, applies MinMax scaling, and trains comparable LSTM and GRU models using TensorFlow/Keras. Both models are evaluated with Mean Squared Error using the same train/test split and training configuration, with the experiment organized into modular data, model, training, evaluation, and visualization components.

Outcome / Learning

Both recurrent architectures captured the temporal pattern in the dataset, with the GRU producing a slightly lower test MSE in the recorded experiment: 0.007073 versus 0.007380 for the LSTM. The project provided hands-on experience with sequence construction, recurrent neural networks, preprocessing, controlled model comparison, evaluation, and structuring an academic notebook experiment as a reproducible ML repository.

Key Features

  • LSTM and GRU recurrent neural-network comparison
  • Daily temperature time-series forecasting
  • 10-day sliding lookback sequence generation
  • MinMax feature scaling
  • 80/20 sequential train-test split
  • Common training configuration for model comparison
  • MSE-based train and test evaluation
  • Training and validation loss analysis
  • Modular Python ML pipeline
  • Automated data tests and CI workflow
  • Reproducible experiment documentation