Skip to content

This repository contains a solution for predicting household energy consumption based on historical data and weather information.

Notifications You must be signed in to change notification settings

Ansem-chaieb/Energy_Consumption_Prediction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔋✨ Energy Consumption Prediction Solution

This repository contains a solution for predicting household energy consumption based on historical data and weather information.

📚 Table of Contents

  1. 📖 Project Overview
  2. 🔧 Prerequisites
  3. 🚀 Quick Start
  4. 📡 API Usage
  5. 📊 Streamlit Dashboard
  6. 🗂 Project Structure
  7. 🤝 Contributing

📖 Project Overview

This project aims to predict the next value of the "active_power" column in a dataset of household energy consumption. The solution includes:

  • 📈 Data preprocessing and feature engineering
  • 🧠 Model training and evaluation
  • 📊 A Streamlit dashboard for data visualization and model insights
  • 🐳 Containerized model deployment
  • 🌐 A Flask API for serving predictions
  • ☁️ Cloud infrastructure design suggestion
  • ⚙️ Considerations for production-scale operationalization

☁️ Cloud Infrastructure Schema

Our proposed cloud infrastructure leverages AWS services to create a scalable, maintainable, and secure solution.

For a detailed diagram and explanation of the infrastructure, please refer to the pdf file.

🔧 Prerequisites

  • Python
  • TensorFlow
  • Streamlit
  • Docker
  • Flask

🚀 Setup and Installation

  1. Clone this repository:
https://github.com/Ansem-chaieb/ve2max_assessment.git

cd Energy_Consumption_Prediction
  1. Build and run the Docker container:
docker build -t energy-consumption-prediction .

docker run -p 5000:5000 energy-consumption-prediction

📡 API Usage

Access the Flask API:

  • Via web browser or curl: http://localhost:5000
  • Using Postman: Import the provided Postman collection:
{
    "datetime": "2024-01-05 23:59:00"
}
  • Using Thunder Client VS Code extension:
    1. Install the Thunder Client extension in VS Code
    2. Click on the Thunder Client icon in the sidebar
    3. Create a new request to http://localhost:5000/predict
    4. Set the method to POST and add the JSON body as shown:

Note: To run the Flask API, please ensure that you have the AWS credentials properly configured in the .env file. If you wish to execute the API, I will need to send you the necessary credentials beforehand.

Thunder Client Usage

📊 Streamlit Dashboard

The Streamlit dashboard provides interactive visualizations of the dataset and model performance. It includes:

Access the Streamlit dashboard (EDA and model result) at: https://householdenergyconsumption.streamlit.app/

Little example

🗂 Project Structure

energy-consumption-prediction/
├── src/
│   ├── dataset.py        # Manages data loading, preprocessing, and train test split
│   ├── features.py       # Responsible for feature engineering and processing
│   ├── dashboard.py      # Contains code for creating the Streamlit dashboard
│   ├── plots.py          # Includes functions for generating various plots and visualizations
│   └── modeling/
│       ├── train.py      # Handles the training process 
│       └── predict.py    # Manages the prediction process using trained models
│
├── notebooks/
│   └── train_evaluate_models.ipynb    # Jupyter notebook for training and evaluating different models
├── docs/
│   └── Household_energy_consumption.pdf
├── Dockerfile
├── app.py                # Flask application
├── requirements.txt
└── README.md

🤝 Contributing Members

Data Scientist: Ansem Chaieb

About

This repository contains a solution for predicting household energy consumption based on historical data and weather information.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published