Skip to the content.

🌱 Watt-Seer Household

Smarter Homes, Greener Future
GenAI Capstone Project by WattWise Innovators

👥 Team Members


🔍 Problem

Ever stared at your energy bill wondering, “What’s using all that power?”
That curiosity sparked our GenAI capstone. In a world of smart homes, why is understanding energy use still so hard?

🚨 Why does this matter?
Because we live in a world of smart homes and connected devices, yet understanding home energy usage is still far from intuitive. Dashboards and charts exist—but they can feel impersonal, complex, or even intimidating to the average person.

What if, instead of scrolling through bar charts, you could just ask your home a question like, “Why was my energy usage so high last winter?” …and get an answer that makes sense?

🌍 That was our mission: to build a system where energy analytics becomes a conversation, not just a spreadsheet. And to do that, we combined efficient Artficial Intelligence, Machine Learning with the Natural Language power of Generative AI for Data Insights.


🤖 Solution

We combined optimal Artificial Intelligence and Machine Learning, alongside Data Processing with the conversational power of GenAI.

Users ask plain English questions; AI runs the appropriate code and replies in conversational language.


🗝️ From Numbers to Meaning: Modeling & Analysis


🧠 GenAI Tech Stack


🎥 Project Walkthrough: Watch Our Energy‑Saving Innovation in Action 🌍

Watch the video

💚 Click the image above and Discover how “Watt Seer Household” empowers families to track their energy usage, reduce costs, and contribute to a greener planet — all with the help of AI. 💕


💻 Try Watt-Seer-Household Yourself!

🔗 To view the Watt-Seer-Household Kaggle Notebook 👉 click here!


📊 Visualization Output: The Overall Energy Story, Visualized & Explained

🌠 Imagine you input your Home IDs and want to acquire information based on it. Watt‑Seer‑Household gets to work and presents:

Here we see how outdoor temperature varies by season for your two home IDs.

image

Caption: Outdoor Temperature (°C) over time for Home IDs 3 (left) and 4 (right)

❄️ 2. Energy vs. Outdoor Temperature

Next, appliance‐level consumption plotted against outdoor temperature.

image

Caption: Energy Consumption (kWh) vs. Outdoor Temperature (°C) for Home IDs 1 (left) and 2 (right)

🏡 3. Energy vs. Household Size

Same scatter, but now versus household size instead of temperature.

image

Caption: Energy Consumption (kWh) vs. Household Size for Home IDs 1 (left) and 2 (right)


🌻 What if you want to see aggregated consumption? Watt-Seer-Household also illustrates the overall enery consumption based on different parameters:

☀️ 1. Mean Energy vs. Mean Outdoor Temperature

Aggregate view: each appliance’s mean consumption against mean outdoor temperature.

image

Caption: Mean Energy Consumption (kWh) vs. Mean Outdoor Temperature (°C) across all homes

🌇 2. Mean Energy vs. Mean Household Size

And finally, mean consumption versus mean household size.

image

Caption: Mean Energy Consumption (kWh) vs. Mean Household Size across all homes


✨ The AI Analyst’s Take

📍 LLM Comparison Summary:

📌 Aggregate Insights from Mean Trends:

By pairing peer‑level comparisons with population‑level trends, Watt‑Seer‑Compare turns raw kWh data into clear narratives and actionable insights—for example, pinpointing which appliance behaviors to target for greener, smarter living.


🚀 Code Highlights Walkthrough

🧪 1. Statistical Validation: Normality & Kruskal–Wallis Seasonal Tests

from scipy.stats import normaltest, kruskal

# 1. Normality test
_, p = normaltest(df['Outdoor Temperature (°C)'])
alpha = 0.05
if p > alpha:
    print("Outdoor temperatures look Gaussian.")
else:
    print("Outdoor temperatures don't look Gaussian.")

# 2. Kruskal–Wallis H‑test across seasons
_, p = kruskal(
    *[group['Outdoor Temperature (°C)'].values
      for _, group in df.groupby('Season')]
)
if p > alpha:
    print("Outdoor temperatures have the same distribution per season.")
else:
    print("Outdoor temperatures don't have the same distribution per season.")

# followed by correlation analysis & outlier detection

⏳ 2. Data Loading & Gemini Configuration

import pandas as pd
import numpy as np
from kaggle_secrets import UserSecretsClient
from google import generativeai as genai

df = pd.read_csv("/kaggle/input/.../smart_home_energy_consumption_large.csv")
df.columns = df.columns.str.strip()

api_key = UserSecretsClient().get_secret("GOOGLE_API_KEY")
genai.configure(api_key=api_key)
model = genai.GenerativeModel('gemini-1.5-flash')

# followed by preliminary EDA, datetime parsing, data validation routines

📚 3. TF‑IDF‑Based Chunk Retrieval

from sklearn.feature_extraction.text import TfidfVectorizer

dataset_text = df.to_csv(index=False)
def split_text(text, chunk_size=1000):
    return [text[i:i+chunk_size] for i in range(0, len(text), chunk_size)]

chunks = split_text(dataset_text)
vectorizer = TfidfVectorizer().fit(chunks)
chunk_embeddings = vectorizer.transform(chunks)

def retrieve_relevant_chunks(query, top_k=1000):
    query_vec = vectorizer.transform([query])
    similarities = (chunk_embeddings * query_vec.T).toarray().flatten()
    top_indices = np.argsort(similarities)[-top_k:]
    return [chunks[i] for i in top_indices]

🔁 4. Prompt Construction & Retry Logic

import time

def build_prompt(query):
    context = "\n".join(retrieve_relevant_chunks(query))
    return f"{context}\n\nQuestion: {query}\n\nAnswer:"

def gemini_answer(prompt):
    for attempt in range(3):
        try:
            response = model.generate_content(prompt)
            return response.text.strip()
        except Exception as e:
            if "quota" in str(e).lower():
                time.sleep(2 ** attempt)
            else:
                return f"Gemini API error: {e}"
    return "Gemini failed after retries." 

🌡️ 5. Energy‑by‑Parameter Visualization Helper

def plot_energy_by_appliance():
total = df.groupby("Appliance Type")["Energy Consumption (kWh)"] \
          .sum().sort_values()
total.plot(kind="barh", figsize=(10, 6))
plt.title("Total Energy Consumption by Appliance")
plt.xlabel("Energy Consumption (kWh)")
plt.show()

# followed by plot_monthly_usage & plot_household_size

🐼 6. Pandas + GenAI Query Handler

def answer_query(query):
    q = query.lower().strip().replace("usage", "energy consumption")
    if "temperature" in q and "energy" in q:
        df_clean = df[["Outdoor Temperature (°C)", "Energy Consumption (kWh)"]].dropna()
        df_clean["Temp Range"] = pd.cut(
            df_clean["Outdoor Temperature (°C)"],
            bins=[-20, 0, 10, 20, 30, 50],
            labels=["Freezing", "Cold", "Cool", "Warm", "Hot"]
        )
        avg_usage = df_clean.groupby("Temp Range", observed=True)["Energy Consumption (kWh)"].mean()
        pandas_answer = "📊 Average energy consumption by temperature range:\n\n" + avg_usage.to_string()
        prompt = (
            f"You are a helpful data analyst assistant.\n"
            f"Pandas Result: {pandas_answer}\n"
            f"Question: {query}\n"
            f"Explanation:"
        )
        return f"{pandas_answer}\n\nGemini Explanation: {gemini_answer(prompt)}"
    # …other patterns…
    return gemini_answer(build_prompt(query))

    # followed by other patterns, fallback, visuals

▶️ 7. REPL‑Style Main Loop

def main():
    print("Enter a query (type 'quit' to stop or 'visuals' to view charts):")
    while True:
        query = input("Question: ").strip()
        if query.lower() == "quit":
            print("Exiting. Goodbye!")
            break
        elif "visual" in query.lower():
            plot_energy_by_appliance()
            plot_monthly_usage()
            plot_household_size()
        else:
            ans = answer_query(query)
            print(f"\n❓Q: {query}\n💡A: {ans}\n")

main()

🔮 Code Output

Q: Which types of appliances used the most energy?
A: Top 5 Appliances by Energy Consumption:

Appliance Type Total Energy (kWh)
Air Conditioning 35,233.06
Heater 34,930.78
Dishwasher 11,138.51
Lights 11,092.12
Oven 10,963.51

💡 Air Conditioning and Heater consumed the most energy, significantly outpacing other appliances.


Q: What was the total energy consumption in January?
A: The total consumption in January was 3,234.75 kWh.

Month Total Energy (kWh)
January 3,234.75

💡 January shows moderate energy usage, likely due to heating and lighting needs during colder months.


🎬 What’s Next?

🔭 Scale this to real smart homes or partner utilities:


💬 Final Thoughts

This project was about giving data a voice with conversational AI can transform raw energy logs into clear, actionable guidance. By giving your data a human voice, Watt‑Seer_Household empowers homeowners to uncover insights, drive efficiency, and make greener choices—one question at a time.

🚀 Smarter homes. Better answers. Greener future. 💎