Pump_failure_training

Workshop Banner GitHub Pages

Predictive Maintenance: Failure Classifier - Workshop πŸ§ͺ

Overview πŸ“‹

This hands-on workshop guides participants through building and evaluating various classification models to predict equipment failures. Participants will learn by working through a series of Jupyter notebooks, from data loading and preparation to model training and evaluation, and finally deploying a model with a Streamlit application.

What You’ll Learn 🧠

Getting Started πŸ› οΈ

βœ… Recommended Platform: Google Colab. Google Colab provides a free, interactive environment that’s ideal for this workshop. No local installation is required!

What You Need:

Running the Notebooks in Colab:

  1. Access the Notebooks:
    • Open the main GitHub repository page for this workshop.
    • Navigate to the soluciones/ directory.
  2. Open in Colab:
    • Click on a notebook file (e.g., 01_load_and_clean_data.ipynb).
    • Look for an β€œOpen in Colab” badge/button at the top of the notebook preview on GitHub. Click it.
    • Alternatively, if the badge isn’t available:
      • On the GitHub notebook page, click the β€œRaw” button. Copy the URL from your browser’s address bar.
      • Open Google Colab (https://colab.research.google.com/).
      • Select File > Open notebook.
      • Choose the β€œGitHub” tab, paste the URL, and press Enter.
  3. Install Dependencies (in Colab):
    • Once a notebook is open in Colab, the first code cell in many notebooks will be for installing necessary libraries from the requirements.txt file.
    • Run this cell by pressing Shift+Enter or clicking the play button.

Running the Streamlit Application Locally:

  1. Clone the repository:
    git clone <repository-url>
    cd <repository-folder>
    
  2. Create a virtual environment (recommended):
    python -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
    
  3. Install dependencies:
    pip install -r requirements.txt
    
  4. Run the app:
    streamlit run main.py
    

    Your web browser should open with the application running.

Deploying to Streamlit Cloud:

For a live, shareable version of your application, you can deploy it to Streamlit Cloud for free.

  1. Push your code to a GitHub repository.
  2. Sign up for Streamlit Cloud: Go to share.streamlit.io and sign up with your GitHub account.
  3. Deploy the app:
    • Click on β€œNew app”.
    • Select your repository and the branch where your code is.
    • Ensure the β€œMain file path” is set to main.py.
    • Click β€œDeploy!”.

Workshop Sessions πŸ“š

Each session corresponds to a Jupyter notebook in the soluciones/ directory.

Session Notebook Topic
1 01_load_and_clean_data.ipynb Loading, Inspecting & Cleaning Data
2 02_transform_data.ipynb Data Transformation
3 03_baseline_model.ipynb Creating a Baseline Model
4 04_random_forest_model.ipynb Random Forest Classification
5 05_xgboost_model.ipynb XGBoost Classification
6 06_light_gbm_model.ipynb LightGBM (LGBM) Classification
7 07_automl_pycaret.ipynb AutoML with PyCaret
(Optional) main.py (Streamlit app) Deploying a Model with Streamlit (Demo)

Learning Outcomes 🎯

By the end of this workshop, you’ll be able to:

Repository Structure πŸ“

.
β”œβ”€β”€ figuras/                     # Contains images used in the Streamlit application
β”‚   └── icone.png
β”‚   └── maintenance.jpg
β”œβ”€β”€ soluciones/                  # Workshop notebooks: from data processing to modeling
β”‚   β”œβ”€β”€ 01_load_and_clean_data.ipynb
β”‚   β”œβ”€β”€ 02_transform_data.ipynb
β”‚   β”œβ”€β”€ 03_baseline_model.ipynb
β”‚   β”œβ”€β”€ 04_random_forest_model.ipynb
β”‚   β”œβ”€β”€ 05_xgboost_model.ipynb
β”‚   β”œβ”€β”€ 06_light_gbm_model.ipynb
β”‚   └── 07_automl_pycaret.ipynb
β”œβ”€β”€ data/                        # Contains datasets for the workshop
β”‚   β”œβ”€β”€ raw_data.csv
β”‚   β”œβ”€β”€ clean_data.csv
β”‚   └── transformed_data.csv
β”œβ”€β”€ main.py                      # Example Streamlit application script for model deployment
β”œβ”€β”€ model/                       # Contains a pre-trained example model and preprocessing objects
β”‚   β”œβ”€β”€ final_model.joblib
β”‚   β”œβ”€β”€ label_encoder.pkl
β”‚   └── preprocessor_pipeline.pkl
β”œβ”€β”€ requirements.txt             # Lists Python dependencies for local setup / Colab
└── utils.py                     # Utility functions for metrics and preprocessing

Prerequisites πŸ“Ύ

Additional Resources (Optional) πŸ“š