# Predictive Maintenance: Machine Failure Prediction Analysis
> Explore a machine learning study on failure prediction for CNC milling workstations using sensor data, XGBoost, and comparative feature engineering.

Tags: predictive-maintenance, machine-learning, failure-prediction, ai4i-2020, xgboost, industrial-ai, data-science
## Predictive Maintenance: Machine Failure Prediction
*   Author: Petar Yankov
*   Objective: Predict machine failure using raw sensor data to reduce downtime in industrial settings.

## Project Purpose & Domain
*   Context: CNC Milling Workstations.
*   Sensors: Measure load, vibration, and temperature.
*   Goal: Compare sensors-only models against models using specific failure indicators.

## Dataset Overview: AI4I 2020
*   Source: UCI Repository (Synthetic dataset).
*   Quality: Clean data with no missing values.
*   Class Imbalance: ~97% normal operation vs. ~3% failure rate.

## Feature Engineering Strategy
*   Version A (Realistic): Sensors only (Air/Process Temp, Rotational Speed, Torque, Tool Wear).
*   Version B (Upper Bound): Includes failure flags like TWF, HDF, PWF, OSF, and RNF (Note: contains near-target leakage).

## Label Analysis & Failure Distribution
*   Total Mismatches: Only 27 cases where indicators and targets didn't align.
*   Primary Failure Causes: Heat Dissipation (HDF) and Power Failures (PWF) are the most frequent.

## Modeling Strategy
*   Algorithms: Random Forest, XGBoost, and Gradient Boosting.
*   Imbalance Handling: Used Class Weights and Scale Pos Weight; avoided SMOTE to keep data pure.
*   Selection Criteria: Prioritized Recall to ensure failures are caught.

## Performance Results
*   Version A (Sensors Only): XGBoost was the best performer with ~0.78 Recall and ~0.82 PR-AUC.
*   Version B (Indicators): Achieved near-perfect scores, confirming indicators act as proxy labels.

## XAI & Industry Application
*   Explainable AI (XAI): Feature importance is critical for building trust with engineers.
*   Future Work: Transition to real-world time-series data with high-resolution timestamps.
---
This presentation was created with [Bobr AI](https://bobr.ai) — an AI presentation generator.