Skip to content

About

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.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

ย 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿญ Production Line Performance Checker

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.


๐ŸŒ Live Demo

API URL

https://production-line-performance-checker.onrender.com

Swagger Documentation

https://production-line-performance-checker.onrender.com/docs

GitHub Repository

https://github.com/Anish-185/Production-Line-Performance-Checker


๐Ÿ“Œ Project Overview

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

๐ŸŽฏ Objectives

  • 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

๐Ÿ“Š Dataset

AI4I 2020 Predictive Maintenance Dataset

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

๐Ÿง  Machine Learning Pipeline

Data Preprocessing

  • Removed unnecessary columns
  • Selected predictive features
  • Feature scaling using StandardScaler
  • Train-Test Split

Model

Random Forest Classifier

Chosen because:

  • Strong baseline performance
  • Handles nonlinear relationships
  • Robust to noise
  • Provides feature importance scores

๐Ÿ“ˆ Model Performance

Classification Report

Accuracy: 98%

Precision: 92%
Recall: 81%
F1 Score: 85%

ROC-AUC Score

0.9647

Cross Validation

5-Fold Cross Validation Performed

๐Ÿ“‰ Confusion Matrix

Example:

[[1914   18]
 [  18   50]]

Interpretation:

  • 1914 Correct Non-Failures
  • 50 Correct Failures
  • 18 False Positives
  • 18 False Negatives

๐Ÿ” Feature Importance

Most influential features:

  1. Torque
  2. Rotational Speed
  3. Tool Wear
  4. Air Temperature
  5. Process Temperature
  6. Machine Type

๐Ÿค– Explainable AI (SHAP)

SHAP (SHapley Additive exPlanations) was used to explain model predictions.

Benefits:

  • Understand model decisions
  • Identify important features
  • Improve transparency
  • Increase trust in predictions

๐Ÿš€ REST API

Built using FastAPI.

Endpoints

Home

GET /

Response:

{
  "message": "Production Line Performance Checker"
}

Predict Failure

POST /predict

Request:

{
  "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 Support

Build Docker Image

docker build -t production-line-checker .

Run Container

docker run -p 8000:8000 production-line-checker

Open:

http://localhost:8000/docs

โ˜๏ธ Cloud Deployment

Deployed on Render.

Production URL:

https://production-line-performance-checker.onrender.com

Swagger UI:

https://production-line-performance-checker.onrender.com/docs

๐Ÿ“‚ Project Structure

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

๐Ÿ› ๏ธ Tech Stack

Machine Learning

  • Python
  • Pandas
  • NumPy
  • Scikit-Learn

Explainability

  • SHAP

Visualization

  • Matplotlib

Backend

  • FastAPI
  • Uvicorn

Deployment

  • Docker
  • Render

Version Control

  • Git
  • GitHub

๐Ÿ“š Key Learnings

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

๐Ÿ”ฎ Future Improvements

  • XGBoost implementation
  • Hyperparameter tuning
  • CI/CD using GitHub Actions
  • Monitoring and logging
  • Kubernetes deployment
  • Real-time streaming predictions
  • Interactive frontend dashboard

๐Ÿ‘จโ€๐Ÿ’ป Author

Anish Gutti

GitHub: https://github.com/Anish-185

Project Repository: https://github.com/Anish-185/Production-Line-Performance-Checker


โญ If you found this project useful, consider giving it a star on GitHub!

About

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.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages