Skip to content
Charan Kumar Reddy
AI & AgentsData & MLCompleteSynthetic data

PartSense

Predictive maintenance tuned for recall on rare failures

Predictive-maintenance and warranty analytics: an XGBoost failure classifier with a tuned operating threshold, one-vs-rest failure-mode diagnosers, an Isolation Forest anomaly ranker, SHAP explanations and DuckDB warranty KPIs in a Dockerized Streamlit app.

Free-tier hosting; the first request after idle can take 30 to 60 seconds.

XGBoost PR-AUC vs 0.430 for a logistic baseline (3.4% positives)
0.888
reports/metrics.json
recall (62 of 68 failures) at a 50% precision floor
91.2%
reports/metrics.json

The problem

Component failures are rare (3.4% of parts), so a model can look accurate while missing most failures, and maintenance teams also need the failure mechanism and the warranty cost, not just a probability.

The approach

Physics-derived features (spindle power, thermal gradient, cumulative tool strain) feed an XGBoost classifier whose threshold is tuned on out-of-fold predictions for recall at a precision floor, with per-mode diagnosers, an Isolation Forest ranker, SHAP explanations and DuckDB SQL KPIs.

Architecture

  1. 01

    Telemetry and leakage audit

    UCI AI4I 2020 telemetry (10,000 rows) is schema-checked, and verify_zero_data_leakage() aborts with a DataLeakageError if identifiers or failure-mode labels enter the feature set.

  2. 02

    Physics feature engineering

    Spindle power (torque × angular speed), process-air temperature difference, cumulative tool strain (wear × torque) and one-hot product-quality variants.

  3. 03

    Champion classifier

    XGBoost with scale_pos_weight for the imbalance; the decision threshold (0.3927) is tuned on out-of-fold training predictions to maximise recall with precision of at least 0.5.

  4. 04

    Failure-mode diagnosers and anomaly ranker

    One-vs-rest XGBoost models for heat-dissipation, power, overstrain and tool-wear failures, plus an Isolation Forest fitted on normal parts only for inspection ranking.

  5. 05

    Explainability and warranty KPIs

    SHAP TreeExplainer waterfalls per prediction; a seeded synthetic parts, claims and sales layer in DuckDB serves 7 versioned SQL KPI queries.

  6. 06

    Streamlit app in Docker

    A multipage app (health monitor, batch scoring, warranty analytics, metrics) loads every number from reports/metrics.json and runs in a non-root, health-checked container.

Key decisions

  • Reports PR-AUC alongside ROC-AUC because at 3.4% prevalence the logistic baseline's ROC-AUC of 0.94 hides a PR-AUC of 0.43.
  • Picks a recall-first operating threshold: recall rises from 89.7% to 91.2% and F1 falls from 0.72 to 0.65, accepting more false alarms because a missed failure costs more than an inspection.
  • Marks random electronic-noise failures (4 test cases) as not learnable instead of reporting a misleading score, and reports the weak tool-wear diagnoser (PR-AUC 0.06) as it is.
  • Fits the Isolation Forest on normal parts only and reports precision and recall at fixed inspection budgets (top 1% to 20%), which is how a maintenance team would use it.
  • Generates warranty tables from a fixed seed instead of using proprietary OEM data, so every KPI is reproducible.

Results

  • Held-out test split of 2,000 parts with 68 failures: XGBoost PR-AUC 0.888 vs 0.430 for logistic regression, and recall 91.2% at precision 50.4% with the tuned threshold.
  • Heat-dissipation, power and overstrain diagnosers reach test PR-AUC of 0.97 to 1.0.
Measured results and the files they come from
MetricValueSource
XGBoost PR-AUC vs logistic baseline (3.4% positives)0.888 vs 0.430reports/metrics.json
Recall at tuned threshold (precision floor 0.5)91.2% (62/68)reports/metrics.json
ROC-AUC on held-out split0.9825reports/metrics.json

How it is tested

  • 31 pytest unit and smoke tests, run in CI.
  • The leakage audit runs before every training and inference pass.

Limits, stated plainly

  • AI4I 2020 is itself a synthetic benchmark dataset, and the warranty layer is generated, so the results do not transfer directly to field data.
  • The tool-wear failure diagnoser is weak (test PR-AUC 0.06), and random failures cannot be predicted from these signals.

Stack

PythonXGBoostscikit-learnSHAPDuckDBStreamlitDockerpytest