← Back
University courseworkDeep Learning — Mini projectGroup project

Time series with LSTM: energy and stocks

Forecasting electricity demand and stock prices, compared against honest baselines

Problem

Test LSTM and GRU on real time series and measure whether they beat simple baselines.

Data

PJME hourly (Kaggle, robikscube/hourly-energy-consumption); Mastercard stock history (CSV); American Airlines (AAL) weekly from Alpha Vantage (~1,088 weeks since 2005).

Data source →

Methods

  • Temporal 80/20 split and scaler fitted on train only
  • 24-hour windows → next hour
  • Stacked LSTMs with Dropout and EarlyStopping
  • LSTM vs GRU
  • Baselines: persistence, moving average and EMA; directional accuracy and lag analysis

Results

  • Electricity demand (PJME), 1 hour ahead: MAE 554.08 MW, RMSE 710.87 MW, MAPE 1.91%, R² 0.9880.
  • Mastercard: LSTM RMSE of USD 8.69 vs USD 12.54 for the GRU (≈31% lower error).
  • AAL: the LSTM barely matches persistence and directional accuracy is around 50%; documented as a correct, honestly measured result.

Tools

PythonTensorFlow / Kerasscikit-learnpandasAlpha Vantage APIDatabricks

University work; no claim of sole individual authorship.