02 Projects / Process sheet PS-02

Predictive Maintenance

Three business questions answered on a 92,000-row logistics fleet dataset: which vehicles need maintenance, what it will cost, and how to segment the fleet by risk. Explained with SHAP.

Purpose & scope

Predict the failure before it stops the fleet

A logistics company needs to reduce unplanned breakdowns. The dataset: 92,000 vehicles, 27 features - usage hours, brake and tire condition, load, fuel efficiency, route, last maintenance date. Each business question maps to its own modeling task: classification, regression, clustering.

PythonXGBoostSHAPSQLscikit-learnKMeans · DBSCANSQLite star schema · 8 tables

Operation sequence · Routing

Seven operations, one pipeline

One notebook per operation, plus five standalone SQL files that step from SELECT/WHERE to window functions.

Op.OperationScope
10EDA27 features, class imbalance, correlation, outliers
20Fleet SQL analysisJOINs, CTEs, window functions on an 8-table star schema
30Feature engineeringvehicle_age, overload_ratio, days_since_maintenance · leakage detection and removal
40ClassificationDummy → Logistic Regression → Random Forest → XGBoost · imbalance handled
50RegressionDummy → Linear → RF → XGBoost · log-transform for skewed targets
60ClusteringKMeans (k=2) + DBSCAN · PCA visualization · post-hoc label validation
70SHAP interpretationglobal importance, beeswarm, dependence, waterfall for the highest-risk vehicle

Measured values

Three tasks, three scorecards

0.902
PR-AUC · classification · XGBoost
0.784
F1 · classification · Logistic Regression
0.885
R² · cost regression · Random Forest
$530
RMSE · cost regression · Random Forest

Clustering, reported honestly

KMeans at k=2 scored a modest silhouette of 0.083, but the post-hoc validation gave the clusters an operational meaning: overloaded versus normally-loaded vehicles. A weak score with a real-world interpretation beats a pretty score without one.

Interpretation · SHAP

The model confirmed the domain knowledge

Key finding

Brake_Condition is the dominant risk predictor across the fleet. That is exactly what 17 years in vehicle development would suggest: the model did not replace the domain knowledge, it quantified and confirmed it. The SHAP waterfall for the single highest-risk vehicle turns that into a management-ready explanation.

Data discipline

Feature engineering included explicit leakage detection and removal, and the star schema (vehicle fact table plus brake, route, weather, model and other dimensions) kept the SQL analysis clean. Predictive quality is a data problem before it is a modeling problem.

Read the notebooks.

Seven notebooks and five SQL files, from raw fleet data to SHAP waterfalls: the full chain is public and reproducible.

Domain confirmedPS-02 · Pos. 02