AI-powered system for predicting electricity consumption and providing personalized optimization recommendations using RAG, Agentic AI, and MLOps.
🎯 SDG 7 - Affordable and Clean Energy
- 📊 Energy Forecasting - ML models (Linear Regression, Random Forest, XGBoost)
- 🔍 SHAP Explainability - Transparent, interpretable predictions
- 🚨 Anomaly Detection - Identify unusual consumption patterns
- 🤖 RAG-Powered Chat - Knowledge base with semantic search
- 🧠 Agentic AI - Google Gemini-powered energy advisor
- 💡 Smart Recommendations - Personalized optimization tips
- 💰 Bill Estimation - Indian tariff slab calculations
- 🌍 Carbon Tracking - CO₂ emissions with India factors (0.82 kg/kWh)
- 📈 MLflow Tracking - Experiment logging and model registry
- ⚙️ Optuna Tuning - Automated hyperparameter optimization
- 🐳 Docker Ready - Containerized deployment
- 🚀 FastAPI Backend - REST API for integrations
sustainability/
├── api/ # FastAPI backend
│ ├── main.py # API entry point
│ ├── schemas.py # Pydantic models
│ └── routes/ # Endpoint handlers
├── src/
│ ├── data/ # Data pipeline
│ ├── training/ # ML model trainers
│ ├── mlops/ # MLflow + Optuna
│ ├── anomaly/ # Anomaly detection
│ ├── agent/ # LLM/RAG components
│ ├── carbon/ # Carbon calculations
│ └── train_models.py # Training orchestrator
├── dashboard/
│ └── app.py # Streamlit UI
├── Dockerfile # Container build
├── docker-compose.yml # Multi-service setup
├── docs/ # Documentation
│ ├── DECISION_LOG.md # Technical decisions
│ ├── MODULE_MAP.md # Module responsibilities
│ └── KNOWN_UNKNOWNS.md # Limitations
└── ARCHITECTURE.md # System design
# Install dependencies
pip install -r requirements.txt
# Generate data & train models
python src/data/data_generator.py
python src/train_models.py
# Launch dashboard
streamlit run dashboard/app.py# Run dashboard only
docker-compose up -d dashboard
# Run with MLflow
docker-compose --profile mlops up -d
# Run with API
docker-compose --profile api up -duvicorn api.main:app --reload
# Swagger docs: http://localhost:8000/docs| Endpoint | Method | Description |
|---|---|---|
/api/v1/predict |
POST | Get consumption forecast |
/api/v1/recommend |
GET | Get optimization tips |
/api/v1/carbon |
POST | Calculate CO₂ emissions |
/api/v1/carbon/quick |
GET | Quick carbon lookup |
/health |
GET | Health check |
| Model | MAPE | Status |
|---|---|---|
| Linear Regression | 0.00% | ✅ Baseline |
| Random Forest | 2.71% | ✅ Production |
| XGBoost | 3.07% | ✅ Production |
| LSTM | - | 🔄 Planned |
Target: MAPE < 10% ✅ Achieved
# View experiments
mlflow ui --port 5000# Optimize XGBoost
python src/mlops/optuna_tuning.py --model xgboost --n-trials 50python src/anomaly/detector.py
# Output: 438/8760 anomalies (5.0%)CO₂ (kg) = kWh × 0.82
India grid emission factor: 0.82 kg CO₂/kWh (CEA 2023)
- ✅ Fairness - Unbiased datasets and recommendations
- ✅ Transparency - SHAP explanations for all predictions
- ✅ Privacy - No personal data storage
- ✅ Auditability - Rule-based recommendations, not black-box
| Dimension | Impact |
|---|---|
| 🌍 Environmental | 15-25% energy reduction potential |
| 👥 Social | Increased sustainability awareness |
| 💰 Economic | Lower electricity bills |
MIT License - Built for SDG 7: Affordable and Clean Energy
Developer: Kaustubh Agrawal | Manipal Institute of Technology, Bengaluru
Built with ❤️ for a sustainable future