Skip to content

Latest commit

 

History

History
57 lines (41 loc) · 2.63 KB

File metadata and controls

57 lines (41 loc) · 2.63 KB

Transformer-Based Multivariate Time-Series Forecasting

This project implements a Transformer architecture using PyTorch to perform multivariate time-series forecasting on the Electricity Load Diagrams dataset (UCI, 2011–2014). The goal is to predict future energy consumption based on past patterns across multiple clients.


Project Overview

Feature Description
Data Electricity usage from 370 clients (15-min intervals)
Model Transformer (PyTorch, custom positional encoding)
Input Window 24 hours of hourly consumption data
Prediction Horizon Next 6 hours for all 10 clients
Metrics MAE, RMSE, Visual Plots
Training Time ~45 minutes on Colab GPU

Project Structure

File Description
load_data.py Loads and parses the .txt dataset
preprocess_data.py Resamples, normalizes, and builds sequences
model.py Transformer model with positional encoding
train.py Training loop and validation logic
evaluate.py Evaluation metrics and forecast visualizations
best_transformer_model.pth Trained model checkpoint
sample1.png sample2.png sample3.png True vs predicted plots
requirements.txt Dependencies
README.md This file

Sample Results

The following plots show true vs predicted consumption for one client (Feature 0) across a 6-hour forecast.

Sample 0 Sample 1 Sample 2
Sample 0 Sample 1 Sample 2

Final Evaluation Metrics:

  • MAE: 0.0019
  • RMSE: 0.0020

The model accurately captures patterns on real energy data, with very low error, even when trained on a subset of clients.


How to Run

1. Clone the Repository

git clone https://github.com/your-username/transformer-time-series-forecasting.git
cd transformer-time-series-forecasting