A complete data analysis project for predictive maintenance based on the AI4I 2020 Predictive Maintenance Dataset.
This repository covers the full pipeline from data understanding, preprocessing, exploratory data analysis, intelligent modeling, to actionable maintenance recommendations.
Industrial equipment failure can cause significant downtime and economic loss. This project builds a reproducible analytical workflow to predict machine failure using sensor and operational data. The dataset contains 10,000 records of industrial machinery with a severe class imbalance: only 3.39% of samples are failures.
- Understand data quality, distributions, and feature relationships
- Clean and engineer features for modeling
- Explore failure patterns across product types and operating conditions
- Build and compare multiple classification models
- Deliver data-driven maintenance recommendations
The following figures are generated by the analysis scripts and saved to output/figures/.
| Feature | Description |
|---|---|
Air temperature [K] |
Air temperature around the machine |
Process temperature [K] |
Process temperature during operation |
Rotational speed [rpm] |
Rotational speed of the machine |
Torque [Nm] |
Torque applied during operation |
Tool wear [min] |
Tool wear time in minutes |
Type |
Product type: L (Low), M (Medium), H (High) |
Machine failure |
Target variable: 0 = normal, 1 = failure |
HDF / PWF / OSF / RNF / NF |
Five specific failure type flags |
- Total samples: 10,000
- Failure rate: 3.39% (severely imbalanced)
- Source: UCI Machine Learning Repository
.
├── 01_data_loading_and_understanding.py
├── 02_data_preprocessing.py
├── 03_exploratory_data_analysis.py
├── 04_modeling_and_evaluation.py
├── 05_maintenance_recommendations_and_conclusion.py
├── data/
│ ├── ai4i2020.csv
│ └── processed_data.csv
├── output/
│ └── figures/
├── requirements.txt
└── README.md
| Script | Purpose |
|---|---|
01_data_loading_and_understanding.py |
Load data, print shape, dtypes, and summary statistics |
02_data_preprocessing.py |
Handle missing values, outliers, encoding, scaling, and feature engineering |
03_exploratory_data_analysis.py |
Generate 7+ analyses and 7+ visualization figures |
04_modeling_and_evaluation.py |
Train and compare 5 models, handle class imbalance, evaluate performance |
05_maintenance_recommendations_and_conclusion.py |
Summarize insights and provide actionable maintenance recommendations |
# 1. Clone the repository
git clone https://github.com/lingchenlijing/AI4I-2020-Predictive-Maintenance-Dataset.git
cd AI4I-2020-Predictive-Maintenance-Dataset
# 2. Install dependencies
pip install -r requirements.txt
# 3. Run the pipeline in order
python 01_data_loading_and_understanding.py
python 02_data_preprocessing.py
python 03_exploratory_data_analysis.py
python 04_modeling_and_evaluation.py
python 05_maintenance_recommendations_and_conclusion.pyNote: The scripts should be run in order because later steps depend on outputs generated by earlier steps.
- The dataset is severely imbalanced, requiring special handling such as class weights or resampling techniques.
- Product type and tool wear are strongly associated with failure risk.
- Temperature, torque, and rotational speed interactions reveal distinct failure clusters.
- Tree-based ensemble models (e.g., Random Forest, Gradient Boosting) generally achieve better recall for the minority failure class.
- Feature importance analysis highlights operational parameters that should be monitored in real time.
Based on data analysis and modeling results:
- Prioritize high-wear and high-type components: Machines with high product type and elevated tool wear should be scheduled for inspection more frequently.
- Monitor temperature and torque interactions: Anomalous combinations of process temperature and torque are early indicators of potential failure.
- Implement condition-based maintenance: Use the trained model to score real-time operational data and trigger maintenance before failures occur.
- Address class imbalance in production monitoring: Failure events are rare; monitoring systems should be tuned to maximize recall rather than accuracy alone.
- Track specific failure modes separately: Different failure types (HDF, PWF, OSF, RNF, NF) have different physical causes and should be handled by specialized maintenance protocols.
This project is for educational and research purposes. The original dataset is provided by the UCI Machine Learning Repository.











