Skip to content
All projects
03ML Model Comparison2026

Freight Cost Prediction

Pulled invoice data, engineered one feature that mattered, then ran three models head-to-head to find what actually predicts freight costs.

LINEAR REGDECISION TREERANDOM FORESTEVALUATIONR2MAERMSE
Problem

Nobody could answer 'what should this shipment cost?' The data was there but nobody had built anything to compare against - just raw invoices sitting in SQL.

Approach
  • Started with correlation analysis - quantity, freight cost, invoice value. Freight per unit showed the strongest signal.
  • Ran Linear Regression, Decision Tree, and Random Forest side-by-side. Random Forest won on R².
Architecture
  1. Invoice SQL dump
  2. Pandas cleanup
  3. Feature: freight per unit
  4. Compare 3 models
  5. Pick best (Random Forest)
Specification
Best model
Random Forest
R² score
0.87
Key feature
Freight per unit
Output
Predicted cost per shipment
Stack
  • Python
  • SQL
  • Pandas
  • Scikit-learn
  • Seaborn
All case studies
Can share the notebook. Just ask.