Production-grade machine learning system for industrial waste prediction
Project description
Waste Prediction Module V4
A production-grade machine learning system for predicting industrial waste compositions based on production volume and environmental parameters.
📊 Model Performance
| Metric | Score |
|---|---|
| R² Score | 0.98 |
| MAE | 1,607 |
| RMSE | 3,092 |
| CV R² (5-Fold) | 0.974 ± 0.005 |
Per-Target R² Scores
| Waste Type | R² |
|---|---|
| Total_Waste_kg | 0.96 |
| Solid_Waste_Limestone_kg | 0.98 |
| Solid_Waste_Gypsum_kg | 0.99 |
| Solid_Waste_Industrial_Salt_kg | 0.98 |
| Liquid_Waste_Bittern_Liters | 0.99 |
| Potential_Epsom_Salt_kg | 0.98 |
| Potential_Potash_kg | 0.99 |
| Potential_Magnesium_Oil_Liters | 0.98 |
🚀 Quick Start
Installation
pip install -r requirements.txt
Training
python train_v4.py
Prediction
from predict_v4 import WastePredictorV4
# Load model
predictor = WastePredictorV4.load('waste_predictor_v4.pkl')
# Make prediction
result = predictor.predict(
production_volume=50000,
rain_sum=200,
temperature_mean=28,
humidity_mean=85,
wind_speed_mean=15,
month=6
)
print(result)
# {'Total_Waste_kg': 125000.5, 'Solid_Waste_Limestone_kg': 12500.0, ...}
Quick Prediction Function
from predict_v4 import quick_predict
result = quick_predict(
production_volume=50000,
rain_sum=200,
temperature_mean=28,
humidity_mean=85,
wind_speed_mean=15,
month=6
)
Batch Prediction
import pandas as pd
from predict_v4 import WastePredictorV4
predictor = WastePredictorV4.load('waste_predictor_v4.pkl')
# Create input DataFrame
data = pd.DataFrame({
'Month': [1, 6, 12],
'production_volume': [30000, 70000, 50000],
'rain_sum': [300, 0, 250],
'temperature_mean': [26, 28, 26],
'humidity_mean': [100, 80, 98],
'wind_speed_mean': [20, 12, 18]
})
# Get predictions
results = predictor.predict_batch(data)
print(results)
📁 Project Structure
local-module/
├── data/
│ └── training/
│ └── training.csv # Training dataset (312 samples)
├── train_v4.py # V4 training (PRODUCTION - R²=0.98)
├── predict_v4.py # V4 inference module
├── waste_predictor_v4.pkl # Trained model checkpoint
├── waste_predictor_v4_metadata.json
├── train_v3.py # V3 training (Neural network)
├── model_v2.py # Enhanced neural network model
├── feature_engineering.py # Feature engineering pipeline
├── requirements.txt # Dependencies
└── README.md
🔧 Input Features
| Feature | Description | Range |
|---|---|---|
production_volume |
Production volume | 0 - 200,000 |
rain_sum |
Total rainfall (mm) | 0 - 1,000 |
temperature_mean |
Average temperature (°C) | 0 - 50 |
humidity_mean |
Average humidity (%) | 0 - 100 |
wind_speed_mean |
Average wind speed (km/h) | 0 - 50 |
month |
Month of year | 1 - 12 |
📤 Output Predictions
| Output | Description |
|---|---|
Total_Waste_kg |
Total waste produced (kg) |
Solid_Waste_Limestone_kg |
Limestone solid waste (kg) |
Solid_Waste_Gypsum_kg |
Gypsum solid waste (kg) |
Solid_Waste_Industrial_Salt_kg |
Industrial salt waste (kg) |
Liquid_Waste_Bittern_Liters |
Bittern liquid waste (L) |
Potential_Epsom_Salt_kg |
Potential Epsom salt byproduct (kg) |
Potential_Potash_kg |
Potential Potash byproduct (kg) |
Potential_Magnesium_Oil_Liters |
Potential Magnesium oil (L) |
🧠 Model Architecture (V4)
Weighted Ensemble of 3 Model Types:
-
XGBoost Gradient Boosting (weight ~33%)
- 500 estimators, max_depth=6
- Per-target models with log-transformed outputs
-
Stacked Ensemble (weight ~34%)
- Level 0: XGBoost + LightGBM + Random Forest + GBR
- Level 1: Ridge regression meta-learner
- 5-fold stacking with passthrough
-
Deep Neural Network (weight ~33%)
- Architecture: 256 → 512 → 256 → 128 with skip connections
- GELU activation, BatchNorm, Dropout
- Cosine annealing LR schedule
Feature Engineering (30+ features):
- Log/sqrt/squared production transforms
- Cyclical month encoding (sin/cos)
- Weather condition indices (wet, dry, evaporation)
- Production × weather interactions
- Domain-driven ratio features
📈 Performance Comparison
| Version | R² Score | MAE | Key Technique |
|---|---|---|---|
| V1 (Original) | 0.47 | 7,873 | Simple MLP |
| V3 | 0.77 | 5,575 | Log transform + Feature eng |
| V4 (Production) | 0.98 | 1,607 | XGBoost + Stacked + DNN Ensemble |
🔄 Retraining
To retrain the model with new data:
- Add new data to
data/training/training.csv - Run training:
python train_v4.py - Model will be saved to
waste_predictor_v4.pkl
📝 License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file waste_predictor-4.0.1.tar.gz.
File metadata
- Download URL: waste_predictor-4.0.1.tar.gz
- Upload date:
- Size: 10.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b48ab3daa247e224b56c03832db47b8af62c44cb0b94f07754f100186f7cb0c3
|
|
| MD5 |
22b3b3ab054a8eddcec6ccdc0027a00f
|
|
| BLAKE2b-256 |
ad78997cc0b10eb5a3c29480014aabd961064ef755ce5d6b08a7cb9485ea4bdf
|
File details
Details for the file waste_predictor-4.0.1-py3-none-any.whl.
File metadata
- Download URL: waste_predictor-4.0.1-py3-none-any.whl
- Upload date:
- Size: 11.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4684f8dc2f8a372c97f41a6063558e806f1f13443164bf081b27fd96cd6301c
|
|
| MD5 |
00af8c3b0fb801a3cf3662bd55d98099
|
|
| BLAKE2b-256 |
181093ed1dff01d2f42cb4d7585e1902a931697217307b90c3628744b6f09a74
|