Skip to content

Nadeem014-r/water-usage-predictor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚰 Smart Water Tank Assistant
AI-Powered Water Usage Prediction & Decision Support System

📌 Project Overview
Water shortage is a common real-life problem in households, hostels, and apartments.
Most traditional systems only show current water level but fail to answer critical questions like:

How long will the water last?
What activities should I avoid today?
What if guests are coming tomorrow?

This project solves that problem by building an AI-powered decision support system that predicts future water usage and converts predictions into clear, actionable suggestions for users.

🎯 Problem Statement

Existing water tank monitoring systems:
Are reactive (warn only after water finishes)
Do not learn from historical usage
Cannot handle real-life situations like guests or weekends
Do not guide users on what actions to take

💡 Proposed Solution
We designed a Smart Water Tank Assistant that:
Learns water usage patterns from historical data
Predicts tomorrow’s water consumption using Machine Learning
Considers real-life factors like:
today’s usage
previous day’s usage
weekdays vs weekends
number of guests
Translates predictions into:
days & hours of water left
allowed activities (showers, laundry, cooking, gardening)
warnings and suggestions
Presents everything through a user-friendly web interface


🧠 Why This Is an AI / ML Project
Uses real public dataset
Applies Machine Learning (Decision Tree Regression)
Predicts future values, not averages
Avoids data leakage
Integrates ML output into real-world decision logic
Includes human-in-the-loop intelligence (guest input)


📊 Dataset Used
Public household water consumption dataset
CSV format
File used:
MLdata/household_water_consumption.csv
Key Columns:
Date
Bathroom_Liters
Kitchen_Liters
Laundry_Liters
Gardening_Liters
Total_Liters



🔧 Feature Engineering (Important Concepts)
1️⃣ Day of Week

data["DayOfWeek"] = data["Date"].dt.dayofweek

Why:
Water usage patterns differ on weekdays and weekends.

2️⃣ Previous Day Total (Historical Trend)

data["Prev_Day_Total"] = data["Total_Liters"].shift(1)

Why:
Recent habits strongly influence next-day consumption.

3️⃣ Today’s Total Usage (Critical Fix)

data["Today_Total"] = Bathroom + Kitchen + Laundry + Gardening

Why:
Balances the model by explicitly telling it what is happening today.

4️⃣ Next Day Target (Avoids Data Leakage)

data["Next_Day_Total"] = data["Total_Liters"].shift(-1)

Why:
Ensures the model predicts future usage, not memorizes past data.


🧪 Model Selection

Model Used:
Decision Tree Regressor (max_depth = 2)
Why Decision Tree?
Handles non-linear patterns
Works well with small datasets
Easy to explain in interviews
Prevents overfitting when depth is limited

⚠️ Major Problem Faced & How It Was Solved
❌ Problem: Feature Dominance

The model predicted high usage even when today’s input was low.

Cause:
Prev_Day_Total dominated predictions, making the model assume habits never change.



✅ Solution Implemented
Added Today_Total as an explicit feature.

Result:
The model now balances:
yesterday’s trend
today’s actual behavior
This improved realism and prediction quality.



👥 Handling Guests (Human-in-the-Loop AI)
Problem:
ML models cannot guess future events like guests.
Solution:
Allow users to input number of guests:
Each guest adds +50 liters
This adjustment is applied after ML prediction, which is the correct real-world approach.



🚨 Critical Edge Case Handling

If today’s usage already exceeds tank capacity:
System triggers Critical Water Alert
All activities are blocked
User is instructed to refill immediately
This makes the system realistic and safe.



🖥️ User Interface (Streamlit)

The project is converted into a user-ready web application using Streamlit.
UI Features:
Clean 2×2 input grid
Metric-based prediction dashboard
Activity breakdown with icons
Color-coded warnings
Simple, readable layout
No need for HTML, JS, or backend frameworks



📌 Example Output

Predicted water usage for tomorrow
Days and hours water will last
Allowed number of:
🚿 showers
🧺 laundry cycles
🍳 cooking activities
🌱 gardening sessions
Clear warnings and suggestions
Prediction confidence level



📈 Confidence Estimation

Based on dataset size:
< 30 records → Low
30–90 records → Medium
> 90 records → High
This communicates model reliability, not randomness.



🛠 Technologies Used
Python
Pandas
Scikit-learn
Decision Tree Regression
Streamlit
CSS (via Streamlit markdown)



🌍 Real-World Applications
Homes & apartments
Hostels
Water-scarce regions
Smart city planning
Sustainable resource management



🔮 Future Enhancements (Not Implemented)

IoT sensors for real-time water level
Cloud deployment
Mobile app interface
Weather-based adjustments

About

A machine learning project that predicts water usage based on historical consumption data to help optimize water management.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages