Skip to main content

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
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:

  1. XGBoost Gradient Boosting (weight ~33%)

    • 500 estimators, max_depth=6
    • Per-target models with log-transformed outputs
  2. Stacked Ensemble (weight ~34%)

    • Level 0: XGBoost + LightGBM + Random Forest + GBR
    • Level 1: Ridge regression meta-learner
    • 5-fold stacking with passthrough
  3. 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:

  1. Add new data to data/training/training.csv
  2. Run training:
    python train_v4.py
    
  3. 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

waste_predictor-4.0.0.tar.gz (10.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

waste_predictor-4.0.0-py3-none-any.whl (11.3 MB view details)

Uploaded Python 3

File details

Details for the file waste_predictor-4.0.0.tar.gz.

File metadata

  • Download URL: waste_predictor-4.0.0.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

Hashes for waste_predictor-4.0.0.tar.gz
Algorithm Hash digest
SHA256 a2a9bb12f60f235f80367c38aa55e707d8bb224165dfa49f008e42b0d05bdd8d
MD5 4feb6960981d0b3c0a0feeca6701159b
BLAKE2b-256 73a3379946899a9b1aa78cb5e437b067e339964ae72b51804212ac58d6da8b14

See more details on using hashes here.

File details

Details for the file waste_predictor-4.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for waste_predictor-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea16002d5557a04da3cbc277cacf9cda17030eed662c1f401f90d287183009ea
MD5 1c5eee89b5b58e44d0bfff10a5f71ccd
BLAKE2b-256 03ff9b1dd9840c50546e66ca779af48700fc0270fd399cac44378a041880b9a7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page