End-to-end electricity demand forecasting project using Python. Covers data preprocessing, exploratory analysis, feature engineering, and machine learning models to predict hourly energy consumption from temperature, humidity, and temporal patterns.
Electricity-Demand-Forecasting/
│
├── data/
│ └── Electricity_Demand_Dataset.csv
│
├── notebook/
│ └── Electricity_demand_ipynb.ipynb
│
├── plots/
│ ├── demand_trend.png
│ ├── correlation_heatmap.png
│ └── prediction_vs_actual.png
│
├── README.md
└── requirements.txt
Electricity demand forecasting helps utilities and industries plan energy supply, reduce blackouts, and optimize cost distribution. This project applies machine learning techniques to predict hourly demand using:
- Temperature
- Humidity
- Time features (hour, day, month, year)
- ✔️ Full end-to-end data science workflow
- ✔️ Clean and well-structured dataset
- ✔️ Exploratory data analysis (EDA)
- ✔️ Machine learning for demand prediction
- ✔️ Time-based and weather-based feature engineering
- ✔️ Visualized insights and model performance plots
| Feature | Description |
|---|---|
| Timestamp | Date and time of record |
| hour | Hour of the day |
| dayofweek | Day of the week |
| month | Month number |
| year | Year |
| dayofyear | Numeric day of the year |
| Temperature | Temperature in Celsius |
| Humidity | Humidity percentage |
| Demand | Electricity demand (target variable) |
Key insights explored:
-
Trend patterns in electricity demand
-
Correlation between temperature, humidity, and demand
-
Daily & seasonal demand cycles
-
Distribution of weather features
The project uses multiple ML regression models, including:
- Linear Regression
- Random Forest Regressor
- Gradient Boosting Regressor
Models were evaluated using:
- RMSE (Root Mean Squared Error)
- MAE (Mean Absolute Error)
- Python
- Pandas, NumPy
- Matplotlib, Seaborn
- Scikit-learn
- Jupyter Notebook
git clone https://github.com/JosephHinga/electricity-demand-forecasting
pip install -r requirements.txt
jupyter notebook notebook/Electricity_demand_ipynb.ipynb
- Deploy the model using FastAPI/Flask
- Build a live dashboard in Power BI/Tableau
- Integrate real-time weather API for dynamic forecasting
- Try advanced time-series models (Prophet, LSTM)
Joseph Hinga Mwangi Data & Risk Analyst | Data Scientist 📧 hingamwangijoseph@gmail.com