Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Project_1_24h-energy-consumption-prediction/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore large data directories
data/*.csv
datasets/
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
x_timestamp,yhat
2020-12-31 00:00:00+05:30,0.06285337389677273
2020-12-31 01:00:00+05:30,0.0779414067052093
2020-12-31 02:00:00+05:30,0.06222471008699352
2020-12-31 03:00:00+05:30,0.05219554075912427
2020-12-31 04:00:00+05:30,0.05723717969284075
2020-12-31 05:00:00+05:30,0.058565367357661206
2020-12-31 06:00:00+05:30,0.10995892204143862
2020-12-31 07:00:00+05:30,0.18344699974685214
2020-12-31 08:00:00+05:30,0.15427799736384254
2020-12-31 09:00:00+05:30,0.2155807264085385
2020-12-31 10:00:00+05:30,0.20905629912941043
2020-12-31 11:00:00+05:30,0.15220458542063398
2020-12-31 12:00:00+05:30,0.0960510283377849
2020-12-31 13:00:00+05:30,0.12343713819079415
2020-12-31 14:00:00+05:30,0.11372958748363775
2020-12-31 15:00:00+05:30,0.12292408973174732
2020-12-31 16:00:00+05:30,0.0873224892064543
2020-12-31 17:00:00+05:30,0.10990953989302502
2020-12-31 18:00:00+05:30,0.12594811958678342
2020-12-31 19:00:00+05:30,0.13203974778234912
2020-12-31 20:00:00+05:30,0.10784505058529184
2020-12-31 21:00:00+05:30,0.12125726524513988
2020-12-31 22:00:00+05:30,0.08112030239674972
2020-12-31 23:00:00+05:30,0.07778420342924022
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
x_timestamp,yhat
2020-12-31 00:00:00+05:30,0.034
2020-12-31 01:00:00+05:30,0.063
2020-12-31 02:00:00+05:30,0.08
2020-12-31 03:00:00+05:30,0.067
2020-12-31 04:00:00+05:30,0.059000000000000004
2020-12-31 05:00:00+05:30,0.066
2020-12-31 06:00:00+05:30,0.27899999999999997
2020-12-31 07:00:00+05:30,0.263
2020-12-31 08:00:00+05:30,0.101
2020-12-31 09:00:00+05:30,0.244
2020-12-31 10:00:00+05:30,0.099
2020-12-31 11:00:00+05:30,0.242
2020-12-31 12:00:00+05:30,0.083
2020-12-31 13:00:00+05:30,0.076
2020-12-31 14:00:00+05:30,0.122
2020-12-31 15:00:00+05:30,0.057999999999999996
2020-12-31 16:00:00+05:30,0.041999999999999996
2020-12-31 17:00:00+05:30,0.087
2020-12-31 18:00:00+05:30,0.112
2020-12-31 19:00:00+05:30,0.243
2020-12-31 20:00:00+05:30,0.176
2020-12-31 21:00:00+05:30,0.08700000000000001
2020-12-31 22:00:00+05:30,0.106
2020-12-31 23:00:00+05:30,0.06
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
,MAE,WAPE,sMAPE,RMSE
HistGradientBoosting,0.047507219928675626,0.3489970242694261,0.3604810029785683,0.06551220231679815
baseline,0.061583333333333344,0.45240281603917976,0.464261941461343,0.08665496715903441
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Project_1_24h-energy-consumption-prediction/data/INFO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## Place the dataset here (Ex: CEEW - Smart meter data Bareilly 2020.csv)
45 changes: 45 additions & 0 deletions Project_1_24h-energy-consumption-prediction/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Fast-Track 24h Electricity Demand Forecast

This project provides a lightweight, end-to-end forecasting pipeline for predicting the next 24 hours of electricity demand for Bareilly and Mathura, using historical smart meter data and optional weather forecasts.

## Why This Exists

Power utilities need quick, reasonably accurate demand forecasts for operational decisions like generation scheduling, demand response, and grid balancing. Traditional forecasting setups often require complex feature pipelines or proprietary software.

This script aims to bridge that gap by:
- Automating data cleaning & hourly aggregation from smart meter CSVs.
- Using seasonal naive and ridge regression methods for fast forecasts.
- Optionally enriching with weather data via Open-Meteo.
- Producing plots, metrics, and a PDF report within minutes — no complex MLOps stack needed.

## How It Works

1. Data ingestion:
Loads smart meter readings, cleans timestamps, finds the energy column, and resamples to hourly.

2. Preprocessing:
- Imputes short missing gaps (forward fill + interpolation).
- Caps extreme outliers at 1st/99th percentile.

3. Optional Weather:
Fetches hourly temperature forecasts for Bareilly and merges with demand data.

4. Feature Engineering:
Builds time features (hour, sin/cos, day of week), lagged values, and 24h rolling means.

5. Forecasting:
- Baseline: Seasonal naive = repeat yesterday’s hour values.
- Ridge Regression: Trains on last N days, autoregressively predicts next 24 hours.

6. Evaluation & Reporting:
If ground truth is available for the forecast horizon, computes MAE, WAPE, sMAPE and RMSE.
Generates plots and a 2-page PDF report with metrics and visualizations.

## Usage

# Run pipeline for Bareilly, 7 days history, without weather
python run_forecast.py --city Bareilly --data_path "data\CEEW - Smart meter data Bareilly 2020.csv" --history_window 7 --with_weather false --make_plots true --save_report true


# Run pipeline for Mathura, 7 days history, without weather
python run_forecast.py --city Mathura --data_path "data\CEEW - Smart meter data Mathura 2020.csv" "data\CEEW - Smart meter data Mathura 2020.csv" --history_window 7 --with_weather false --make_plots true --save_report true
Binary file not shown.
6 changes: 6 additions & 0 deletions Project_1_24h-energy-consumption-prediction/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pandas
numpy
scikit-learn
matplotlib
joblib
requests
Loading