CoolFace
Modelpublic

hectorferrandizsanchis/energy-demand-forecasting-lstm

sourceHugging Facemitupdated 8mo agoView on Hugging Face
0likes
Model Card

Energy Demand Forecasting System (Germany)

Author: Hector Ferrandiz Sanchis Profile: Junior Machine Learning Engineer (18 years old)


Overview

This project is an end-to-end energy demand forecasting system built on German hourly electricity consumption data. It has been designed with production-style structure, reproducibility, and model comparison in mind.

The goal is not only to train accurate forecasting models, but to demonstrate professional ML engineering practices, including:

  • —Feature engineering pipelines
  • —Multiple model families (baseline, statistical, deep learning)
  • —Consistent evaluation
  • —Model registry and versioning
  • —Reproducible environments

Objectives

  • —Forecast short-term electricity demand (hourly, 168-hour horizon)
  • —Compare classical baselines vs deep learning models
  • —Build a clean, extensible ML pipeline
  • —Practice industry-style project organization

Project Structure

time-series-forecasting-opsd/ ├── src/ │ ├── features/ # Feature engineering pipelines (model-scoped) │ ├── models/ # Training, prediction, registry │ ├── evaluation/ # Metrics and comparisons │ └── utils/ # Logging and helpers │ ├── data/ │ ├── raw/ # Original dataset │ └── processed/ # Feature-engineered parquet files │ ├── models/ │ ├── lstm/ # LSTM training runs and artifacts │ ├── arima/ # SARIMAX runs │ └── registry/ # Model registry (JSON-based) │ ├── reports/ │ └── predictions/ # Saved model predictions │ ├── pyproject.toml # Dependency and environment definition ├── poetry.lock # Reproducible dependency versions └── README.md


Models Implemented

1. Baseline Models

Several simple baselines are implemented to establish reference performance:

  • —Naive last value
  • —Naive daily
  • —Naive seasonal (primary baseline)
  • —Moving average variants

Baselines are automatically evaluated and stored for comparison.


2. LSTM (Deep Learning)

A multivariate LSTM forecasting model built with TensorFlow/Keras.

Key characteristics:

  • —Sliding window input (168 timesteps)
  • —Multiple engineered features (temporal cycles, lags, exogenous signals)
  • —Standard scaling
  • —GPU-compatible training
  • —Full artifact saving (model, scaler, feature columns)

Final LSTM performance (test horizon = 168):

  • —MAE: ~2328
  • —RMSE: ~2719
  • —MAPE: ~4.5%

Compared to the primary baseline:

  • —Significant RMSE improvement
  • —Comparable MAE with better stability on peaks

3. SARIMAX (Statistical)

A classical SARIMAX model with exogenous variables:

  • —Wind
  • —Solar
  • —Cyclical time features

Auto ARIMA search is used with controlled limits.

This model is included mainly for methodological comparison and completeness.


Feature Engineering

Feature engineering is model-scoped, meaning each model family only receives the features it needs.

Examples:

  • —Cyclical encoding (hour, day of week, month)
  • —Lagged demand values
  • —Exogenous variables (wind, solar)
  • —Scaling performed only on training data

All feature metadata is saved for reproducibility.


Model Registry

A lightweight MLflow-style model registry is implemented using JSON and filesystem storage.

Capabilities:

  • —Model versioning
  • —Metric tracking
  • —Latest version resolution
  • —Promotion to production
  • —Artifact management

This allows consistent comparison and future extension.


Reproducibility

The project uses Poetry for dependency and environment management.

Key points:

  • —Python version and dependencies are fully specified
  • —Environments are reproducible across machines
  • —No local virtual environments or large artifacts are committed

Motivation

This project was built as a learning and portfolio project, with a strong focus on:

  • —Clean code
  • —Correct methodology
  • —Realistic ML workflows
  • —Engineering discipline over shortcuts

At 18 years old, my goal is to demonstrate readiness for junior ML / data roles, while continuing to improve model quality and system design.


Future Work

  • —Add cross-validation for time series
  • —Improve SARIMAX diagnostics and evaluation
  • —Add richer visualizations and dashboards
  • —Deploy inference as a simple API
  • —Extend model registry with experiment tracking

Author

Hector Ferrandiz Sanchis Junior Machine Learning Engineer Age: 18

This project reflects my current technical level and learning trajectory.