An end-to-end Machine Learning and MLOps project that predicts machine failures in a manufacturing production line using sensor data. The project includes model training, explainability, a REST API built with FastAPI, Docker containerization, and cloud deployment on Render.
https://production-line-performance-checker.onrender.com
https://production-line-performance-checker.onrender.com/docs
https://github.com/Anish-185/Production-Line-Performance-Checker
Unexpected machine failures can cause significant downtime and financial losses in manufacturing environments.
This project uses machine sensor readings to predict whether a machine is likely to fail before failure occurs, enabling predictive maintenance and reducing operational costs.
The system:
- Collects machine operating parameters
- Predicts machine failure probability
- Provides explainable AI insights using SHAP
- Exposes predictions through a FastAPI REST API
- Runs locally with Docker
- Is deployed publicly on Render
- Build a predictive maintenance model
- Identify the most important factors affecting machine failure
- Explain model decisions using SHAP
- Deploy the model as a production-ready API
- Containerize the application using Docker
The dataset contains simulated manufacturing machine data including:
| Feature | Description |
|---|---|
| Type | Machine Type |
| Air Temperature | Ambient temperature |
| Process Temperature | Process operating temperature |
| Rotational Speed | Speed of machine rotation |
| Torque | Torque generated |
| Tool Wear | Tool usage duration |
| Machine Failure | Target Variable |
Dataset Size:
10,000 rows
14 columns
Target:
Machine Failure
0 = No Failure
1 = Failure
- Removed unnecessary columns
- Selected predictive features
- Feature scaling using StandardScaler
- Train-Test Split
Chosen because:
- Strong baseline performance
- Handles nonlinear relationships
- Robust to noise
- Provides feature importance scores
Accuracy: 98%
Precision: 92%
Recall: 81%
F1 Score: 85%
0.9647
5-Fold Cross Validation Performed
Example:
[[1914 18]
[ 18 50]]
Interpretation:
- 1914 Correct Non-Failures
- 50 Correct Failures
- 18 False Positives
- 18 False Negatives
Most influential features:
- Torque
- Rotational Speed
- Tool Wear
- Air Temperature
- Process Temperature
- Machine Type
SHAP (SHapley Additive exPlanations) was used to explain model predictions.
Benefits:
- Understand model decisions
- Identify important features
- Improve transparency
- Increase trust in predictions
Built using FastAPI.
GET /Response:
{
"message": "Production Line Performance Checker"
}POST /predictRequest:
{
"Type": 1,
"Air_temperature": 300,
"Process_temperature": 310,
"Rotational_speed": 1500,
"Torque": 40,
"Tool_wear": 10
}Response:
{
"machine_failure": 0,
"failure_probability": 0.0213
}docker build -t production-line-checker .docker run -p 8000:8000 production-line-checkerOpen:
http://localhost:8000/docs
Deployed on Render.
Production URL:
https://production-line-performance-checker.onrender.com
Swagger UI:
https://production-line-performance-checker.onrender.com/docs
Production-Line-Performance-Checker/
โ
โโโ app/
โ โโโ main.py
โ
โโโ data/
โ โโโ ai4i2020.csv
โ
โโโ models/
โ โโโ model.pkl
โ โโโ scaler.pkl
โ โโโ feature_importance.png
โ โโโ roc_curve.png
โ โโโ shap_summary.png
โ
โโโ src/
โ โโโ train.py
โ โโโ explain.py
โ
โโโ Dockerfile
โโโ requirements.txt
โโโ README.md
โโโ .dockerignore
- Python
- Pandas
- NumPy
- Scikit-Learn
- SHAP
- Matplotlib
- FastAPI
- Uvicorn
- Docker
- Render
- Git
- GitHub
Through this project I learned:
- End-to-end machine learning workflows
- Feature engineering and preprocessing
- Model evaluation and validation
- Explainable AI using SHAP
- API development with FastAPI
- Docker containerization
- Cloud deployment with Render
- Git and GitHub workflows
- XGBoost implementation
- Hyperparameter tuning
- CI/CD using GitHub Actions
- Monitoring and logging
- Kubernetes deployment
- Real-time streaming predictions
- Interactive frontend dashboard
Anish Gutti
GitHub: https://github.com/Anish-185
Project Repository: https://github.com/Anish-185/Production-Line-Performance-Checker