File size: 3,287 Bytes
58216f5
78a2cc6
 
 
 
 
 
 
58216f5
78a2cc6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
---
library_name: scikit-learn
tags:
  - scikit-learn
  - regression
  - time-series-forecasting
  - electricity-consumption
  - pakistan
---

# ⚡ BijliCast

## Overview

BijliCast is a weather-aware household electricity
consumption forecasting system developed for Pakistan.

It uses historical household electricity consumption,
weather conditions, calendar information and household
characteristics to predict next-hour electricity usage.

The prediction target is `next_hour_energy_kwh`.

## Model Information

| Property | Value |
|---|---|
| Model | HistGradientBoostingRegressor |
| Framework | Scikit-learn |
| Task | Time-series regression |
| Artifact | deployment_model.joblib |
| Model size | Approximately 1.4 MB |
| Input features | 42 raw features |

The saved artifact includes the fitted preprocessing
pipeline and the trained estimator.

## Dataset

BijliCast combines two independent public data sources:

1. LUMS REWD-P household electricity dataset.
2. Open-Meteo ERA5 historical weather data.

Dataset characteristics:

- 59 households
- Six Pakistani cities
- 515,786 hourly electricity records

The weather information is joined with household
electricity measurements using temporal and geographic
alignment.

## Methodology

The ML lifecycle includes:

- Exploratory Data Analysis
- Missing-value handling
- Feature engineering
- Lag and rolling statistics
- Chronological train/validation/test splitting
- Scikit-learn preprocessing Pipeline
- Baseline comparisons
- Multiple regression algorithms
- Five-fold TimeSeriesSplit cross-validation
- Randomized hyperparameter optimization

The final deployment pipeline was fitted using
training and validation data. The held-out test set
was excluded from model fitting and selection.

## Model Selection

Random Forest achieved a validation MAE of 0.3216 kWh,
while HistGradientBoosting achieved 0.3273 kWh.

Their cross-validation variation indicated practically
comparable performance.

HistGradientBoosting was selected for deployment
because it offered comparable predictive quality
with a substantially smaller serialized artifact.

Random Forest: approximately 270 MB
HistGradientBoosting: approximately 1.4 MB

This made HGB considerably more practical for
GitHub-based and lightweight deployment.

## Evaluation Results

Held-out test results:

| Metric | Result |
|---|---:|
| MAE | 0.2499 kWh |
| RMSE | 0.4273 kWh |
| R² | 0.7291 |

These are final evaluation results, not the
criteria used to select the model.

## Prediction Interval

The application provides a 90% prediction interval
using residual-based offsets estimated from
out-of-sample validation predictions.

## Intended Use

- Academic research
- Household electricity consumption analysis
- Short-term residential load forecasting
- Educational machine learning demonstrations

## Limitations

- The dataset covers 59 households.
- Coverage is limited to six Pakistani cities.
- The demo uses historical replay data rather
  than live smart-meter readings.
- The model is not intended for electricity billing
  or grid operational decisions.

## Repository

Full source code, notebooks, reports and deployment:

https://github.com/muhammad-umar-218980/BijliCast

## Data Sources

- https://rewdp.lums.edu.pk/
- https://open-meteo.com/