Skip to content

Latest commit

ย 

History

10 Commits

Folders and files

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

Repository files navigation

โš™๏ธ Predictive Maintenance Equipment Failure

Python Scikit-Learn Streamlit Power BI SQL GitHub Accuracy ROC--AUC Render

An end-to-end Predictive Maintenance and Machine Failure Detection project that uses Machine Learning, SQL, Power BI, and Streamlit to analyze industrial equipment data, identify failure patterns, estimate machine failure probability, and support maintenance decision-making.

The project combines exploratory data analysis, machine learning, business intelligence, and an interactive prediction application into a complete predictive-maintenance workflow.


๐Ÿš€ Live Demo

๐ŸŒ Try the application here

Open Predictive Maintenance App


๐Ÿš€ Project Demo

๐Ÿ–ฅ๏ธ Interactive Streamlit Application

The Streamlit application allows users to enter machine operating conditions and receive an instant failure-risk prediction.

Machine Operating Conditions
          โ”‚
          โ–ผ
   Machine Failure Model
          โ”‚
          โ–ผ
 Failure Probability
          โ”‚
          โ–ผ
 Risk Classification
          โ”‚
          โ–ผ
 Maintenance Recommendation

๐Ÿ“Œ Overview

Unexpected industrial equipment failures can lead to production downtime, maintenance costs, and operational disruption.

This project aims to predict the likelihood of machine failure based on operating conditions such as:

  • Machine Type
  • Air Temperature
  • Process Temperature
  • Rotational Speed
  • Torque
  • Tool Wear

The project follows an end-to-end data analytics and machine-learning workflow:

Raw Machine Data
       โ”‚
       โ–ผ
Data Cleaning & Exploration
       โ”‚
       โ–ผ
Feature Analysis
       โ”‚
       โ–ผ
Machine Learning
       โ”‚
       โ–ผ
Gradient Boosting Model
       โ”‚
 โ”Œโ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
 โ–ผ     โ–ผ              โ–ผ
SQL   Power BI     Streamlit
Analysis Dashboard Application
                       โ”‚
                       โ–ผ
                Failure Prediction

โญ Project Highlights

  • ๐Ÿค– Machine Failure Prediction using Gradient Boosting
  • ๐Ÿ“Š Exploratory Data Analysis
  • ๐Ÿ” Failure Pattern Analysis
  • ๐Ÿ—„๏ธ SQL-based Data Analysis
  • ๐Ÿ“ˆ Power BI Interactive Dashboard
  • ๐Ÿ–ฅ๏ธ Streamlit Prediction Application
  • โš ๏ธ Failure Risk Classification
  • ๐Ÿ“‰ Failure Probability Estimation
  • ๐Ÿ”Ž Risk Factor Identification
  • ๐Ÿ“‹ Prediction History
  • ๐Ÿค– Model Performance Dashboard
  • ๐Ÿ’พ Saved Machine Learning Pipeline
  • ๐Ÿ”ง Maintenance Recommendations
  • ๐Ÿงช Multiple Prediction Scenarios

๐Ÿ“ธ Project Preview

Power BI Dashboard

Power BI Dashboard


Streamlit Dashboard

Streamlit Dashboard


Low-Risk Prediction

Low Risk Prediction


High-Risk Prediction

High Risk Prediction


Prediction History

Prediction History


โœจ Features

๐Ÿ“Š Exploratory Data Analysis

The project investigates machine operating conditions and their relationship with equipment failure.

Analysis includes:

  • Failure distribution
  • Machine type analysis
  • Torque analysis
  • Rotational speed analysis
  • Tool wear analysis
  • Temperature relationships
  • Failure-mode analysis

๐Ÿค– Machine Learning

A Gradient Boosting Classifier is used to predict whether a machine is likely to fail.

The final model is implemented inside a scikit-learn pipeline containing the required preprocessing and classification steps.


๐Ÿ“ˆ Failure Probability

Instead of providing only a binary prediction, the Streamlit application displays the estimated probability of machine failure.

Example:

Failure Probability
       99.7%

This allows the result to be interpreted as a risk score rather than simply a Yes/No prediction.


โš ๏ธ Risk Classification

The application converts the predicted probability into three operational risk categories:

Failure Probability Risk Level Recommended Action
< 30% ๐ŸŸข Low Continue normal operation
30% โ€“ 69.9% ๐ŸŸก Medium Monitor and schedule inspection
โ‰ฅ 70% ๐Ÿ”ด High Inspect machine before next operating cycle

๐Ÿ” Risk Factor Analysis

The application highlights operating conditions that may contribute to increased risk.

Examples include:

  • โš ๏ธ High Torque
  • โš ๏ธ High Tool Wear
  • โš ๏ธ Low Rotational Speed
  • โš ๏ธ High Temperature Difference

These indicators provide an easier operational interpretation of the prediction.


๐Ÿ“‹ Prediction History

The Streamlit application records predictions during the current session.

The history contains:

  • Machine Type
  • Rotational Speed
  • Torque
  • Tool Wear
  • Failure Probability
  • Prediction Result

Users can also clear the prediction history.


๐Ÿง  Machine Learning Workflow

Machine Dataset
      โ”‚
      โ–ผ
Data Cleaning
      โ”‚
      โ–ผ
Exploratory Data Analysis
      โ”‚
      โ–ผ
Feature Preparation
      โ”‚
      โ–ผ
Train / Test Split
      โ”‚
      โ–ผ
Preprocessing Pipeline
      โ”‚
      โ–ผ
Gradient Boosting Classifier
      โ”‚
      โ–ผ
Model Evaluation
      โ”‚
      โ–ผ
Joblib Model Serialization
      โ”‚
      โ–ผ
Streamlit Prediction App

๐Ÿ† Machine Learning Model

The final model is a Gradient Boosting Classifier.

Model Configuration

GradientBoostingClassifier(
    n_estimators=200,
    learning_rate=0.05,
    max_depth=3,
    random_state=42
)

The complete trained pipeline is saved using Joblib:

app/model/gradient_boosting_pipeline.joblib

This allows the Streamlit application to load the same preprocessing and model pipeline used during training.


๐Ÿ“Š Model Performance

The final Gradient Boosting model achieved the following results on the test set:

Metric Score
Accuracy 99%
Precision 92%
Recall 68%
F1 Score 78%
ROC-AUC 96.5%

Classification Performance

              Precision    Recall    F1-Score

Class 0          0.99       1.00       0.99
Class 1          0.92       0.68       0.78

Accuracy                              0.99

Important Observation

Although the model achieves approximately 99% overall accuracy, the recall for the failure class is approximately 68%.

This is important in a predictive-maintenance context because correctly identifying actual failures is more important than relying only on overall accuracy.

The ROC-AUC score of 96.5% indicates strong discrimination between normal and failure cases.


๐Ÿ—„๏ธ SQL Analysis

SQL was used to perform structured analysis of the machine data and answer business-oriented questions.

The SQL workflow includes:

  • Database/table creation
  • Data loading
  • Data validation
  • Failure analysis
  • Aggregations
  • Business-focused queries

SQL files are available in:

sql/

๐Ÿ“Š Power BI Dashboard

The Power BI dashboard provides an interactive analytical view of machine failures.

The dashboard focuses on:

  • Failure counts
  • Failure modes
  • Machine operating conditions
  • Torque groups
  • Failure patterns
  • Operational trends

The dashboard complements the machine-learning model by providing historical and descriptive analytics, while the Streamlit application provides individual machine-level predictions.


๐Ÿ–ฅ๏ธ Streamlit Application

The Streamlit application provides an interactive interface for machine failure prediction.

Users can enter:

Machine Type
Air Temperature
Process Temperature
Rotational Speed
Torque
Tool Wear

The application then provides:

Prediction
Failure Probability
Risk Level
Recommended Action
Risk Factors
Prediction History

๐Ÿงช Example Predictions

๐ŸŸข Low-Risk Example

Machine Type: H
Air Temperature: 298 K
Process Temperature: 308 K
Rotational Speed: 1650 RPM
Torque: 35 Nm
Tool Wear: 50 min

Observed prediction:

๐ŸŸข LOW FAILURE RISK

Failure Probability: 0.2%

๐Ÿ”ด High-Risk Example

Machine Type: L
Air Temperature: 302 K
Process Temperature: 310 K
Rotational Speed: 1300 RPM
Torque: 65 Nm
Tool Wear: 200 min

Observed prediction:

๐Ÿ”ด HIGH FAILURE RISK

Failure Probability: 99.7%

Identified risk factors:

โš ๏ธ High torque
โš ๏ธ High tool wear
โš ๏ธ Low rotational speed

๐Ÿ› ๏ธ Tech Stack

Category Technology
๐Ÿ Programming Language Python
๐Ÿ“Š Data Processing Pandas, NumPy
๐Ÿ““ Development Jupyter Notebook
๐Ÿค– Machine Learning Scikit-learn
๐ŸŒฒ Final Model Gradient Boosting
๐Ÿ’พ Model Serialization Joblib
๐Ÿ—„๏ธ Database Analysis SQL
๐Ÿ“ˆ Business Intelligence Power BI
๐Ÿ–ฅ๏ธ Web Application Streamlit
๐Ÿ”ง Version Control Git
โ˜๏ธ Repository GitHub

๐Ÿ“‚ Project Structure

Predictive-Maintenance-Equipment-Failure/
โ”‚
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ app.py
โ”‚   โ””โ”€โ”€ model/
โ”‚       โ””โ”€โ”€ gradient_boosting_pipeline.joblib
โ”‚
โ”œโ”€โ”€ data/
โ”‚   โ””โ”€โ”€ raw/
โ”‚
โ”œโ”€โ”€ images/
โ”‚   โ”œโ”€โ”€ powerbi_machine_failure_dashboard.png
โ”‚   โ”œโ”€โ”€ streamlit_dashboard_overview.png
โ”‚   โ”œโ”€โ”€ streamlit_high_risk_prediction.png
โ”‚   โ”œโ”€โ”€ streamlit_low_risk_prediction.png
โ”‚   โ””โ”€โ”€ streamlit_prediction_history.png
โ”‚
โ”œโ”€โ”€ notebooks/
โ”‚   โ””โ”€โ”€ 01_Exploratory_Data_Analysis.ipynb
โ”‚
โ”œโ”€โ”€ powerbi/
โ”‚   โ””โ”€โ”€ Machine_Failure_Intelligence_Dashboard.pbix
โ”‚
โ”œโ”€โ”€ sql/
โ”‚   โ”œโ”€โ”€ 01_database_schema.sql
โ”‚   โ”œโ”€โ”€ 02_data_loading.sql
โ”‚   โ”œโ”€โ”€ 03_data_validation.sql
โ”‚   โ””โ”€โ”€ 04_business_analysis.sql
โ”‚
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ requirements.txt

๐Ÿš€ Installation

1. Clone the Repository

git clone https://github.com/harsh8767/predictive-maintenance-equipment-failure.git

2. Navigate into the Project

cd predictive-maintenance-equipment-failure

3. Create a Virtual Environment

Windows

python -m venv venv
venv\Scripts\activate

Linux / macOS

python3 -m venv venv
source venv/bin/activate

4. Install Dependencies

pip install -r requirements.txt

โ–ถ๏ธ Run the Streamlit Application

From the project root:

streamlit run app/app.py

The application will open in your browser.


๐Ÿ“Œ How to Use the Application

Step 1

Open the Streamlit application.

Step 2

Enter machine operating conditions using the sidebar.

Step 3

Click:

๐Ÿ”ฎ Predict Failure Risk

Step 4

Review:

  • Failure probability
  • Risk classification
  • Recommended action
  • Key risk factors

Step 5

Review previous predictions in the Prediction History section.


๐Ÿ’ก Key Insights

The project demonstrates several important predictive-maintenance concepts:

  • Machine failure is influenced by multiple operating conditions rather than a single variable.
  • Torque and tool wear can be important indicators of increased failure risk.
  • Lower rotational speed combined with higher torque can represent a higher-risk operating condition.
  • Machine-learning probabilities can be translated into operational risk categories.
  • Historical analytics and predictive analytics provide complementary views of equipment health.

โš ๏ธ Limitations

  • The model is trained on historical machine data and may not generalize perfectly to different industrial environments.
  • The failure-class recall is lower than the overall accuracy.
  • Risk thresholds used by the Streamlit application are application-level decision rules.
  • The rule-based risk-factor explanations are intended for interpretability and do not represent the model's exact internal decision process.
  • Real-time sensor integration is not currently implemented.

๐Ÿš€ Future Improvements

Potential future enhancements include:

  • SHAP-based model explanations
  • Real-time IoT sensor integration
  • Automated model retraining
  • Model monitoring and drift detection
  • Time-series failure prediction
  • Maintenance-cost optimization
  • Real-time alerts
  • Cloud deployment
  • Automated maintenance scheduling
  • Integration with industrial monitoring systems

๐Ÿ™ Acknowledgements

This project makes use of the following open-source technologies:

  • Python
  • Pandas
  • NumPy
  • Scikit-learn
  • Joblib
  • Streamlit
  • Power BI
  • SQL
  • Jupyter
  • Git

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

Harsh Chavan

Computer Engineering Student

Passionate about Artificial Intelligence, Machine Learning, Data Analytics, SQL, Power BI, and Python Development.

GitHub

https://github.com/harsh8767

LinkedIn

https://www.linkedin.com/in/harsh-chavan-1646a2257/


๐Ÿ“œ License

This project is licensed under the MIT License.

See the LICENSE file for more information.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages