ML-powered load shedding predictor & backup energy optimizer for South African homes and businesses.
# EskomSense AI
> Predictive Load Forecasting for the South African Power Grid
## Overview
EskomSense AI is a production-grade machine learning pipeline that forecasts South African electricity demand 24 hours ahead using an LSTM (Long Short-Term Memory) neural network. The system ingests historical Eskom load data, trains a sequence model, and exposes predictions via a FastAPI REST endpoint.
## Architecture
`
+---------------+ +----------------+ +-------------+ +---------+ +-----------+
| Data Pipeline |-->| Preprocessing |-->| LSTM Model |-->| FastAPI |-->| Dashboard |
| (CSV load) | | (MinMaxScaler) | | (PyTorch) | | REST | | |
+---------------+ +----------------+ +-------------+ +---------+ +-----------+
`
## Model Architecture
| Layer | Configuration |
|-------------------|----------------------------------------|
| Input Projection | Linear(1 -> hidden_size) |
| LSTM | hidden_size units, num_layers stacked |
| Dropout | Applied between LSTM layers & output |
| Fully Connected | Linear(hidden_size -> 1) |
**Default hyperparameters:** hidden_size=128, num_layers=2, dropout=0.2, lr=1e-3
## Quick Start
`ash
# Install dependencies
pip install -r requirements.txt
# Generate synthetic training data
python -m src.data.generator
# Train the model
python scripts/train.py --data data/sample_data.csv --epochs 50
# Run predictions
python scripts/predict.py
`
## API
Start the server:
`ash
uvicorn src.api.main:app --reload
`
| Endpoint | Method | Description |
|--------------|--------|----------------------------------------------------|
| /health | GET | Liveness probe - returns service status |
| /model/info| GET | Model metadata (architecture, param count, device) |
| /predict | POST | Accepts sequence data, returns predicted MW load |
### Exampl …