Skip to content

JosephHinga/electricity-demand-forecasting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

⚡ Electricity Demand Forecasting Project

Status Python Jupyter Machine Learning License


📌 Project Description

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.


📁 Project Structure

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

📊 Project Overview

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)

🔍 Key Features

  • ✔️ 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

📥 Dataset Summary

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)

🔬 Exploratory Data Analysis (EDA)

Key insights explored:

  • Trend patterns in electricity demand

  • Correlation between temperature, humidity, and demand

  • Daily & seasonal demand cycles

  • Distribution of weather features


🧠 Modeling Approach

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)

🧰 Tools & Technologies

  • Python
  • Pandas, NumPy
  • Matplotlib, Seaborn
  • Scikit-learn
  • Jupyter Notebook

🚀 How to Run the Project

1. Clone the repository

git clone https://github.com/JosephHinga/electricity-demand-forecasting

2. Install dependencies

pip install -r requirements.txt

3. Run the notebook

jupyter notebook notebook/Electricity_demand_ipynb.ipynb

📌 Future Enhancements

  • 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)

👤 Author

Joseph Hinga Mwangi Data & Risk Analyst | Data Scientist 📧 hingamwangijoseph@gmail.com


About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors