A machine learning service for predicting power consumption patterns using FastAPI.
powerbox/
├── ML_Opensource_data/ #Opensource data we early sourced that looks mimicks Nigeria features like weathers etc
│ ├── Prophet #facebook prophet model
│ ├── arima # arima statistical model
│ └── lightGBM # lightgbm model
│ └── SARIMAX # SARIMAX model
│ └── xgboost # xgboost model
│ └── script # script to try the different model
├── ML_powerbox_data/ #data gotten from the actual powerbox unit and used for development and deployment using FAST
│ ├── __init__.py
│ ├── api.py # FastAPI endpoints for predictions
│ └── ML.py # ML model and prediction logic
├── ETL/
│ └── Dashboard/
│ └── dashboard.py # Data visualization dashboard
├── models/ # Saved model files
└── requirements.txt
- Real-time power consumption predictions
- RESTful API endpoints using FastAPI
- Random Forest Regressor model
- Interactive dashboard for data visualization
Predicts power consumption based on input parameters:
- temperature
- solar_output
- battery_energy
- system_load
- hour
- day
- month
- day_of_week
- is_weekend
Returns model metadata and features list
- Install dependencies:
pip install -r requirements.txt
- Start the API server:
uvicorn ML_powerbox_data.api:app --reload
- Access the API documentation:
http://localhost:8000/docs
import requests
data = {
"temperature": 25.0,
"solar_output": 1000.0,
"battery_energy": 5.0,
"system_load": 2.5,
"hour": 14,
"day": 1,
"month": 6,
"day_of_week": 2,
"is_weekend": 0
}
response = requests.post("http://localhost:8000/predict_consumption", json=data)
prediction = response.json()["predicted_consumption"]