├── images ├── icone.png └── maintenance.jpg ├── model └── model.pkl ├── requirements.txt ├── streamlit_setup └── streamlit.py └── README.md /images/icone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thales-vignoli/Failure-Classifier-to-Maintenance/HEAD/images/icone.png -------------------------------------------------------------------------------- /model/model.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thales-vignoli/Failure-Classifier-to-Maintenance/HEAD/model/model.pkl -------------------------------------------------------------------------------- /images/maintenance.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thales-vignoli/Failure-Classifier-to-Maintenance/HEAD/images/maintenance.jpg -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | scikit-learn==1.2.1 2 | streamlit==1.17.0 3 | pandas==1.5.3 4 | numpy==1.23.5 5 | altair<5 6 | matplotlib==3.6.2 7 | seaborn==0.12.1 8 | imbalanced-learn==0.9.1 9 | joblib==1.1.1 10 | backcall==0.2.0 11 | -------------------------------------------------------------------------------- /streamlit_setup/streamlit.py: -------------------------------------------------------------------------------- 1 | import pickle 2 | import streamlit as st 3 | import pandas as pd 4 | 5 | 6 | # Page config 7 | st.set_page_config( 8 | page_title="Failure Classifier", 9 | page_icon="images/icone.png", 10 | ) 11 | 12 | # Page title 13 | st.title('Maintenance - Failure Prediction') 14 | st.image('images/maintenance.jpg') 15 | st.write("\n\n") 16 | 17 | st.markdown( 18 | """ 19 | This app aims to assist in classifying failures, thereby reducing the time required to analyze machine problems. It enables the analysis of sensor data to classify failures swiftly and expedite the troubleshooting process. 20 | """ 21 | ) 22 | 23 | # Load the model 24 | with open('model/model.pkl', 'rb') as model_file: 25 | model = pickle.load(model_file) 26 | 27 | # Streamlit interface to input data 28 | col1, col2 = st.columns(2) 29 | 30 | with col1: 31 | air = st.number_input(label='Air Temperature') 32 | process = st.number_input(label='Process Temperature') 33 | rpm = st.number_input(label='Rotational Speed') 34 | 35 | with col2: 36 | torque = st.number_input(label='Torque') 37 | tool_wear = st.number_input(label='Tool Wear') 38 | type = st.selectbox(label='Type', options=['Low', 'Medium', 'High']) 39 | 40 | # Function to predict the input 41 | def prediction(air, process, rpm, torque, tool_wear, type): 42 | # Create a df with input data 43 | df_input = pd.DataFrame({ 44 | 'Air_temperature': [air], 45 | 'Process_temperature': [process], 46 | 'Rotational_speed': [rpm], 47 | 'Torque': [torque], 48 | 'Tool_wear': [tool_wear], 49 | 'Type': [type] 50 | }) 51 | 52 | prediction = model.predict(df_input) 53 | return prediction 54 | 55 | # Botton to predict 56 | if st.button('Predict'): 57 | predict = prediction(air, process, rpm, torque, tool_wear, type) 58 | st.success(predict) 59 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Failure Classifier to Maintenance 2 | 3 | ## Overview 4 | This project focuses on predictive maintenance in industrial settings, specifically classifying types of failures based on sensor data. Using Jupyter Notebook for data analysis and modeling, streamlit to deploy and CRISP-DM for project organization, we aim to enhance machine reliability and reduce downtime through maintenance strategies. 5 | 6 | ## Objectives 7 | - Classify types of failures using machine learning models. 8 | 9 | ## Data Source 10 | The analysis utilizes the Predictive Maintenance [Dataset](https://www.kaggle.com/datasets/stephanmatzka/predictive-maintenance-dataset-ai4i-2020) (AI4I 2020), containing sensor readings and failure information from industrial equipment. 11 | 12 | ## Project Structure 13 | - **Jupyter Notebook:** Contains data preprocessing, exploratory data analysis (EDA), modeling, and evaluation using Python libraries such as pandas, numpy, and scikit-learn. 14 | - **CRISP-DM Framework:** Organizes the project into phases: business understanding, data understanding, data preparation, modeling, evaluation, and deployment. 15 | - **Streamlit App:** Deploys the trained model for interactive predictions and analysis. 16 | 17 | ## Full Project Article 18 | This repository contains the Jupyter Notebook and Streamlit app for the predictive maintenance project. 19 | 20 | For a detailed description of the project, including methodologies, insights, and model performance, please check out the full article on Medium. The article provides a comprehensive overview of the project's objectives, methodologies, and results. You can find the article using the link below: 21 | 22 | [Medium Article](https://medium.com/@thalesvignoli/introduction-to-dataset-0f12ed05c660). 23 | 24 | Feel free to reach out to me for any questions or feedback regarding the project or the analysis. 25 | 26 | ## Contributing 27 | Contributions and suggestions to improve this project are welcome. 28 | 29 | ## Contact 30 | For inquiries or feedback, you can contact me via [LinkedIn](https://www.linkedin.com/in/thalesvignoli/?locale=en_US). 31 | --------------------------------------------------------------------------------