Predictive Maintenance: Machine Failure Preprocessing Pipeline
An automated machine learning preprocessing pipeline for predictive maintenance that transforms raw industrial sensor data into training-ready datasets for machine failure classification while preventing data leakage.
Overview
This project focuses on building an automated data preprocessing pipeline for a Predictive Maintenance Machine Failure classification problem using the AI4I 2020 Predictive Maintenance Dataset.
The main objective is to transform raw industrial machine data into clean, structured, and machine-learning-ready datasets while applying preprocessing practices that help prevent data leakage.
The classification target is Machine failure, where the system distinguishes between normal machine operation and machine failure.
Machine Learning Task
The project is designed as a binary classification problem:
0— Normal machine operation1— Machine failure
The dataset contains several operational machine features, including:
- Air temperature
- Process temperature
- Rotational speed
- Torque
- Tool wear
- Product type
Automated Preprocessing Pipeline
I developed a reusable Python preprocessing script that automates the data preparation workflow from raw CSV data to machine-learning-ready datasets.
The pipeline performs:
- Loading the raw predictive maintenance dataset.
- Removing unnecessary identifiers and leakage-prone features.
- Separating features and the prediction target.
- Performing stratified train-test splitting.
- Standardizing numerical features.
- Encoding categorical features.
- Transforming training and testing datasets.
- Exporting the processed datasets into reusable CSV files.
Data Leakage Prevention
The preprocessing workflow was designed with data leakage prevention in mind.
Identifier columns and failure-related attributes that could directly expose information about the prediction target are removed before model development.
The dataset is also divided into training and testing sets before feature transformation.
The preprocessing pipeline is fitted only on the training dataset, while the testing dataset is transformed using the fitted preprocessing configuration.
This approach helps provide a more realistic setup for future model training and evaluation.
Feature Preprocessing
Numerical features are standardized using StandardScaler:
- Air temperature
- Process temperature
- Rotational speed
- Torque
- Tool wear
The categorical Type feature is transformed using OneHotEncoder.
These transformations are managed through Scikit-learn's ColumnTransformer to create a consistent and reusable preprocessing workflow.
Pipeline Output
The automated preprocessing workflow produces four datasets:
X_train.csvX_test.csvy_train.csvy_test.csv
These outputs can be directly reused for machine learning model training, evaluation, experimentation, and future MLOps workflows.
Tech Stack
Python, Pandas, NumPy, Scikit-learn, Jupyter Notebook, StandardScaler, OneHotEncoder, ColumnTransformer, and Train-Test Split.
