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.
๐ Try the application here
Open Predictive Maintenance App
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
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
- ๐ค 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
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
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.
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.
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 |
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.
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 Dataset
โ
โผ
Data Cleaning
โ
โผ
Exploratory Data Analysis
โ
โผ
Feature Preparation
โ
โผ
Train / Test Split
โ
โผ
Preprocessing Pipeline
โ
โผ
Gradient Boosting Classifier
โ
โผ
Model Evaluation
โ
โผ
Joblib Model Serialization
โ
โผ
Streamlit Prediction App
The final model is a Gradient Boosting Classifier.
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.
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% |
Precision Recall F1-Score
Class 0 0.99 1.00 0.99
Class 1 0.92 0.68 0.78
Accuracy 0.99
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 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/
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.
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
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%
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
| 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 |
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
git clone https://github.com/harsh8767/predictive-maintenance-equipment-failure.gitcd predictive-maintenance-equipment-failurepython -m venv venv
venv\Scripts\activatepython3 -m venv venv
source venv/bin/activatepip install -r requirements.txtFrom the project root:
streamlit run app/app.pyThe application will open in your browser.
Open the Streamlit application.
Enter machine operating conditions using the sidebar.
Click:
๐ฎ Predict Failure Risk
Review:
- Failure probability
- Risk classification
- Recommended action
- Key risk factors
Review previous predictions in the Prediction History section.
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.
- 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.
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
This project makes use of the following open-source technologies:
- Python
- Pandas
- NumPy
- Scikit-learn
- Joblib
- Streamlit
- Power BI
- SQL
- Jupyter
- Git
Computer Engineering Student
Passionate about Artificial Intelligence, Machine Learning, Data Analytics, SQL, Power BI, and Python Development.
https://www.linkedin.com/in/harsh-chavan-1646a2257/
This project is licensed under the MIT License.
See the LICENSE file for more information.




